Sree <sree...@gmail.com> added the comment:

Thanks, all. I just wanted to know if this was a deliberate decision or an 
oversight. It also took me a while to realize it washex, and not fromhex.

That allows the current behaviour to be easily worked around in Python code, 
and a backwards compatible optional parameter to hex() might allow -nan in the 
future without breaking existing software.

Surprisingly, the standard does allow this [but this may not have been the 
intent] -- (Section 6.2) "Recognize that format conversions,
including conversions between supported formats and external representations as 
character sequences,
might be unable to deliver the same NaN." The conversion to character sequences 
text is key since I'm using a test harness written in Python that writes out 
and reads back text files containing float data.

Section 6.3 in the standard also adds more details on when the sign bit in NaNs 
is relevant.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue42210>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to