mattip <matti.pi...@gmail.com> added the comment: It appears that microsoft decided NAN will be represented by '\x00\x00\x00\x00\x00\x00\xf8\xff', which has the sign bit set. Compiling this c code with visual 9.0 gives the correct answers for the first value, and a mess for the second:
#include <math.h> #include <stdio.h> #include <float.h> int main( void ) { unsigned long nan[2]={0xffffffff, 0x7fffffff}; double g; double z, zn; int i; for (i=0;i<2; i++) { g = *( double* )(nan+i); printf( "g( %g ) is NaN, _isnan(g) %d\n", g, _isnan(g) ); z = _copysign(-3, g); zn = _copysign(-3, -g); printf("z=%g, zn=%g\n", z, zn); } return 0; } This corresponds with loewis 's observation. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue14521> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com