[issue26785] repr of -nan value should contain the sign

Mark Dickinson report at bugs.python.org
Sun Apr 17 17:03:04 EDT 2016


Mark Dickinson added the comment:

The current behaviour is deliberate, so any change would be an enhancement rather than a bugfix. I'm modifying the versions accordingly.

Unlike the sign of a zero, the sign of a NaN has no useful meaning: IEEE 754 explicitly says "this standard does not interpret the sign of a NaN". Yes, that sign is copied by copysign, but I don't think that in itself means that the sign should be included in the repr, and I'm not aware of any applications where the sign matters in that context.

A NaN also has 51 payload bits (or 52 if you're not distinguishing between quiet and signalling NaNs), but like the sign, those bits are rarely important in applications.

I'm not really seeing a case for representing either the sign or the payload bits in the repr. Do you know of any applications that make use of the sign of a NaN?

----------
versions:  -Python 2.7, Python 3.4, Python 3.5

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


More information about the Python-bugs-list mailing list