Message380055
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. |
|
Date |
User |
Action |
Args |
2020-10-31 12:25:13 | mark.dickinson | set | recipients:
+ mark.dickinson, tim.peters, rhettinger, veky, sree314 |
2020-10-31 12:25:13 | mark.dickinson | set | messageid: <1604147113.63.0.131580503795.issue42210@roundup.psfhosted.org> |
2020-10-31 12:25:13 | mark.dickinson | link | issue42210 messages |
2020-10-31 12:25:13 | mark.dickinson | create | |
|