On Aug 14 12:20, Heavenly Avenger wrote: > On 8/14/2018 10:23 AM, Corinna Vinschen wrote: > > I just wonder why returning -NaN when the input is "-nan" isn't the > > better approach. After all: > > > > printf ("nan (\"\") = %f\n", nan ("")); > > printf ("-nan (\"\") = %f\n", -nan ("")); > > > > ==> > > > > nan ("") = nan > > -nan ("") = -nan > > > > So, shouldn't the ideal outcome be this: > > > > strtod ("nan", NULL) = nan > > strtod ("-nan", NULL) = -nan > > strtold ("nan", NULL) = nan > > strtold ("-nan", NULL) = -nan > > > > ? > > > > Corinna > > > I'd say it is not the better/best approach as, even though it makes sense, > all other implementations or linux distributions treat it as a plain "nan". > So anything written for linux will potentially break on cygwin, I am not > sure this is the idea behind cygwin, right?
My point is, even the glibc printf prints a negative NaN as "-nan", see above. strtod/strtold returning a different NaN value looks inconsistent. Well, never mind. Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat
signature.asc
Description: PGP signature