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 mark.dickinson
Recipients mark.dickinson, rhettinger, sree314, tim.peters, veky
Date 2020-10-31.12:25:13
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1604147113.63.0.131580503795.issue42210@roundup.psfhosted.org>
In-reply-to
Content
This isn't a bug: it was a deliberate decision, just like the choice to represent `-nan` as `nan` in `float.__repr__` was a deliberate decision. NaNs don't have a meaningful sign - they have a sign *bit*, but it's best to regard that as just an extra bit of metadata (like the payload bits).

IEEE 754 explicitly refuses to interpret the sign bit of a NaN: section 1.4 of the 2019 version of the standard says: "This standard does not specify [...] Interpretation of the sign and significand fields of NaNs."

As Vedran points out, infinities are a very different beast: the difference between negative infinity and positive infinity matters.

[Raymond]

> no application should rely on seeing a particular sign for a NaN

Yep, exactly.
History
Date User Action Args
2020-10-31 12:25:13mark.dickinsonsetrecipients: + mark.dickinson, tim.peters, rhettinger, veky, sree314
2020-10-31 12:25:13mark.dickinsonsetmessageid: <1604147113.63.0.131580503795.issue42210@roundup.psfhosted.org>
2020-10-31 12:25:13mark.dickinsonlinkissue42210 messages
2020-10-31 12:25:13mark.dickinsoncreate