I need some math whiz help.  So it seems to me that strtod("NAN",
NULL) should return the same as __builtin_nan("").  And G++ should
return the same result as GCC.  For the GCC instance I believe that
the crt/gdtoa/strtodnrp.c code is wrong.  For the G++ instance I
believe stdlib.h isn't correct.  Can someone help me debug the
strtodnrp.c issue?

// -----nan-test.c-----
#include <math.h>
#include <stdlib.h>
#include <stdio.h>

int main()
{
  char *endp;
  printf("strtod(NAN) = %f, nan('') = %f\n", strtod("NAN", &endp),
__builtin_nan(""));
  return 0;
}
-// --end nan-test.c---

$ gcc -o nan-test nan-test.c
$ ./nan-test
strtod(NAN) = -1.#IND00, nan('') = 1.#QNAN0

$ g++ -o nan-test nan-test.C
$ ./nan-test
strtod(NAN) = 0.000000, nan('') = 1.#QNAN0

-- 
Earnie
-- https://sites.google.com/site/earnieboyd

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to