[New-bugs-announce] [issue47031] math.nan should note that NANs do not compare equal to anything
Steven D'Aprano
report at bugs.python.org
Tue Mar 15 18:47:25 EDT 2022
New submission from Steven D'Aprano <steve+python at pearwood.info>:
The IEEE-754 requirement that NANs are never equal to anything, even to themselves, is a common stumbling block for those new to the consequences of IEEE-754. See for example #47020.
The documentation for math.nan would be a good place to add a note like
"Due to the requirements of the `IEEE-754 standard <https://en.wikipedia.org/wiki/IEEE_754>`_, math.nan and float('nan') are never equal to any other value, including themselves. Use math.isnan to test for NANs."
https://docs.python.org/3.8/library/math.html#math.nan
----------
assignee: docs at python
components: Documentation
keywords: easy
messages: 415302
nosy: docs at python, steven.daprano
priority: normal
severity: normal
status: open
title: math.nan should note that NANs do not compare equal to anything
type: enhancement
versions: Python 3.10, Python 3.11, Python 3.7, Python 3.8, Python 3.9
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue47031>
_______________________________________
More information about the New-bugs-announce
mailing list