Well, that's what I get in linux and cygwin for:

#include <stdio.h>
#include <stdlib.h>
#include <math.h> /* the last two printfs requires this */
int main (void) {
  printf ("strtof (\"nan\", NULL) = %f\n", strtof ("nan", NULL));
  printf ("strtof (\"-nan\", NULL) = %f\n", strtof ("-nan", NULL));
  printf ("strtod (\"nan\", NULL) = %f\n", strtod ("nan", NULL));
  printf ("strtod (\"-nan\", NULL) = %f\n", strtod ("-nan", NULL));
  printf ("strtold (\"nan\", NULL) = %Lf\n", strtold ("nan", NULL));
  printf ("strtold (\"-nan\", NULL) = %Lf\n", strtold ("-nan", NULL));
  printf ("nan (\"\") = %f\n", nan (""));
  printf ("-nan (\"\") = %f\n", -nan (""));
}

I get:

Gentoo Linux (native linux)
strtof ("nan", NULL) = nan
strtof ("-nan", NULL) = nan
strtod ("nan", NULL) = nan
strtod ("-nan", NULL) = nan
strtold ("nan", NULL) = nan
strtold ("-nan", NULL) = nan
nan ("") = nan
-nan ("") = -nan

cygwin 2.10.0:
strtof ("nan", NULL) = nan
strtof ("-nan", NULL) = nan
strtod ("nan", NULL) = -nan
strtod ("-nan", NULL) = nan
strtold ("nan", NULL) = -nan
strtold ("-nan", NULL) = -nan
nan ("") = nan
-nan ("") = -nan

So, let's hope the patch does not transform the behavior from the nan from math.h.

And yes, you have a good point. Just, well, different people made those different parts of the code so, better cygwin follow the ""convention"", if we can call it, that. :)


On 8/14/2018 12:35 PM, Corinna Vinschen wrote:
    printf ("nan (\"\") = %f\n", nan (""));
    printf ("-nan (\"\") = %f\n", -nan (""));


--
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

Reply via email to