You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pythongh-114667: Support hexadecimal floating point literals
This add hexadecimal floating point literals (IEEE 754-2008 §5.12.3) and
support construction of floats from hexadecimal strings. Note that the
syntax is more permissive: everything that is currently accepted by the
``float.fromhex()``, but with a mandatory base specifier; it also allows
grouping digits with underscores.
Examples:
```pycon
>>> 0x1.1p-1
0.53125
>>> float('0x1.1')
1.0625
>>> 0x1.1
1.0625
>>> 0x1.1_1_1
1.066650390625
```
Added compatibility code to not break access of existing int attributes.
E.g. 0x1.bit_length() will not require parentheses around the
hexadecimal integer literal (like 1.bit_length() for decimal int).
Minor changes: Py_ISDIGIT/ISXDIGIT macros were transformed to functions.
0 commit comments