-
-
Notifications
You must be signed in to change notification settings - Fork 32.6k
gh-137871: Clarify cmath.nan documentation by linking to math module #137876
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
The documentation for `cmath.nan` and `cmath.inf` is updated to cross-reference the equivalent constants in the `math` module. The `math` module's documentation contains a more thorough explanation of the properties of these special floating-point values, as required by the IEEE 754 standard (e.g., that NaN does not compare equal to itself).
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
@AzizCode92, next time you can combine several suggestions on tab "Files Changed". |
Sure |
Do we not want to do this? |
No. Sorry for that suggestion. This just add link with a same info. |
``float('nan')``. | ||
|
||
See also :data:`math.nan`. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cmath.nan is more equivalent to math.nan than float('nan') in being a fixed data object, with a fixed id, rather than a function which can return different objects with different ids when called multiple times.
``float('nan')``. | |
See also :data:`math.nan`. | |
:data:`math.nan`. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's better. Link just show you same statement of "equivalency". Better just inline it here. In all respect it's "an equivalency", i.e. all nan's in Python are same in sense that we don't have separated signaling/quiet nans and they don't have payload. (Or, in some sense, we don't have simple user interface to this stuff.)
(BTW, I think you suggestion is off by one whitespace.)
The documentation for
cmath.nan
is updated to cross-reference the equivalent constants in themath
module.The
math
module's documentation contains a more thorough explanation of the properties of these special floating-point values, as required by the IEEE 754 standard (e.g., that NaN does not compare equal to itself).cmath.nan
docs: Equivalent tofloat('nan')
#137871📚 Documentation preview 📚: https://cpython-previews--137876.org.readthedocs.build/en/137876/library/cmath.html#cmath.nan