-
-
Notifications
You must be signed in to change notification settings - Fork 33.6k
gh-138580: add sys.float_info.iec_60559 boolean flag #138811
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
This value indicating support the IEC 60559 floating-point standard (the Annex F of C99). If enabled, the float type characteristics matches the IEC 60559 double format and exceptional cases for the math's functions follow to the section F.10 of the C99 standard.
|
I think it would be better if the field was in uppercase but I don't know if we have many other cases like that. |
This will be inconsistent wrt the rest (other field names are also come from macros). |
vstinner
left a comment
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.
LGTM
Co-authored-by: Victor Stinner <vstinner@python.org>
|
I'm thinking if it does make sense to mention this flag in cmath docs. We could say that:
|
|
@picnixz @serhiy-storchaka: What do you think of this change? |
|
I am not sure what is the best place for this constant. What do @mdickinson and @tim-one think about this? Other options are discussed in the issue. |
|
I'm not really comfortable with |
I think, this flag should rather describe conformance with the IEEE 754 / IEC 60559. |
vstinner
left a comment
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.
LGTM
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
|
Lets try to make some progress here.
@serhiy-storchaka, other options so far:
(1) or (2) don't make any sense, as the flag is not C-specific at all. So, (3) is only option. But the sys namespace is already big. And the new flag logically fits float_info: it offers some additional information about float type. Maybe we should rename this flag to sys.float_info.iec_60559? Other fields in this named tuple also have no strict binding to the C standard. Floating-point numbers in C are defined by same model as in the IEC 60559, i.e. have radix ( |
I still support this option ( |
This value indicating support the IEC 60559 floating-point standard (specified by the Annex F of C99, for C language). If enabled, the float type characteristics matches the IEC 60559 double format and exceptional cases for the math's functions follow to the section F.10 of the C99 standard.
📚 Documentation preview 📚: https://cpython-previews--138811.org.readthedocs.build/
https://cpython-previews--138811.org.readthedocs.build/en/138811/library/sys.html#sys.float_info
https://cpython-previews--138811.org.readthedocs.build/en/138811/library/math.html#math.nan