strtod ("nan") returns negative NaN

Masamichi Hosoda trueroad@trueroad.jp
Tue Aug 14 04:46:00 GMT 2018


>>> On Mon, 13 Aug 2018 at 19:46, Duncan Roe <duncan_roe@optusnet.com.au> wrote:
>>>>
>>>> On Mon, Aug 13, 2018 at 12:52:48PM -0400, Stephen John Smoogen wrote:
>>>> > On Mon, 13 Aug 2018 at 11:16, Masamichi Hosoda <trueroad@trueroad.jp> wrote:
>>>> [...]
>>>> > On Fedora 27 with 7.3.1 it gives
>>>> > ```
>>>> > stod ("nan") = nan
>>>> > stod ("-nan") = nan
>>>> > quiet_NaN () = nan
>>>> > ```
[...]
>> Cygwin 2.10.0 64 bit with gcc 7.3.0
>> ```
>> strtod ("nan", NULL) = -nan
>> strtod ("-nan", NULL) = nan
>> nan ("") = nan
>> ```
>> 
>> Ubuntu 16.04 LTS 64 bit with gcc 5.4.0
>> ```
>> strtod ("nan", NULL) = nan
>> strtod ("-nan", NULL) = nan
>> nan ("") = nan
>> ```

I've created the quick hack patch that fixes `strtod ()`.

On Cygwin 64 bit with the patch, result of foobar.c:

```
strtod ("nan", NULL) = nan
strtod ("-nan", NULL) = nan
nan ("") = nan
```

Also result of foobar.cc:

```
stod ("nan") = nan
stod ("-nan") = nan
quiet_NaN () = nan
```
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fix-strtod-nan-returns-qNaN.patch
Type: text/x-patch
Size: 1759 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20180814/e6c234b5/attachment.bin>
-------------- next part --------------

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


More information about the Cygwin mailing list