gh-138580: add sys.float_info.iec_60559 boolean flag#138811
gh-138580: add sys.float_info.iec_60559 boolean flag#138811skirpichev wants to merge 13 commits intopython:mainfrom
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). |
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. |
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