strtod ("nan") returns negative NaN

Masamichi Hosoda trueroad@trueroad.jp
Wed Aug 15 12:55:00 GMT 2018


> On Wed, 15 Aug 2018, Masamichi Hosoda wrote:
> 
>> On Linux with glibc, both strtod ("nan")
>> and strtod ("-nan") return positive NaN.
>> 
>> So I've created the patch that behaves like glibc.
>> Both strtod ("nan") and strtod ("-nan") return positive NaN.
> 
> I would suggest that you should not consider fixed bugs in glibc (bug 
> 23007 in this case) to be appropriate to emulate in other libraries.

I've create the patch that behaves to preserve the sign bit.

The result on Cygwin 64 bit (newlib, x86_64) with the patch:
```
strtof ("nan", NULL) = nan
strtof ("-nan", NULL) = -nan
strtod ("nan", NULL) = nan
strtod ("-nan", NULL) = -nan
strtold ("nan", NULL) = nan
strtold ("-nan", NULL) = -nan
```

Thank you for your suggestion.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: v2-0001-Fix-strtod-nan-returns-negative-NaN.patch
Type: text/x-patch
Size: 1516 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20180815/df2a8cae/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: v2-0002-Fix-strtof-nan-returns-positive-NaN.patch
Type: text/x-patch
Size: 1497 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20180815/df2a8cae/attachment-0003.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