This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients ethan.furman, mark.dickinson, serhiy.storchaka, vstinner
Date 2015-01-07.18:25:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1420655127.93.0.11004486624.issue23185@psf.upfronthosting.co.za>
In-reply-to
Content
There are several different NaNs.

>>> x = struct.unpack('d', b'\x00\x00\x00\x00\x00\x00\xf8\x7f')[0]
>>> x
nan
>>> x == x
False
>>> struct.pack('d', x)
b'\x00\x00\x00\x00\x00\x00\xf8\x7f'
>>> x = struct.unpack('d', b'\x00\x00\x00\x00\x00\x00\xf9\x7f')[0]
>>> x
nan
>>> x == x
False
>>> struct.pack('d', x)
b'\x00\x00\x00\x00\x00\x00\xf9\x7f'

Interesting, but 0*inf and inf-inf return values with the same representation as float('-nan'), not float('nan').

>>> inf = float("inf")
>>> struct.pack('d', 0*inf)
b'\x00\x00\x00\x00\x00\x00\xf8\xff'
>>> struct.pack('d', inf-inf)
b'\x00\x00\x00\x00\x00\x00\xf8\xff'
>>> struct.pack('d', float('nan'))
b'\x00\x00\x00\x00\x00\x00\xf8\x7f'
>>> struct.pack('d', float('-nan'))
b'\x00\x00\x00\x00\x00\x00\xf8\xff'
History
Date User Action Args
2015-01-07 18:25:27serhiy.storchakasetrecipients: + serhiy.storchaka, mark.dickinson, vstinner, ethan.furman
2015-01-07 18:25:27serhiy.storchakasetmessageid: <1420655127.93.0.11004486624.issue23185@psf.upfronthosting.co.za>
2015-01-07 18:25:27serhiy.storchakalinkissue23185 messages
2015-01-07 18:25:27serhiy.storchakacreate