[issue14521] math.copysign(1., float('nan')) returns -1.

Martin v. Löwis report at bugs.python.org
Sat Apr 7 21:06:25 CEST 2012


Martin v. Löwis <martin at v.loewis.de> added the comment:

This is a near duplicate of issue7281. Most likely, copysign is behaving correctly, and it's already the float conversion that errs.

For struct.pack('d', float('nan')), I get '\x00\x00\x00\x00\x00\x00\xf8\xff'; 
for -nan, I get '\x00\x00\x00\x00\x00\x00\xf8\x7f'; 
ISTM that this has the sign bits switched.

----------
nosy: +loewis

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14521>
_______________________________________


More information about the Python-bugs-list mailing list