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
gh-113804: Support "x" and "X" format types for floats
_Py_dg_dtoa_hex() helper is based on float.hex() with additional support
for the precision setting and some format flags. Note (c.f. ``'a'``
format type of the C stdlib), that ``'#'`` option is used to control the
prefix (off by default).
Trailing zeros (and the dot) in fractional part are excluded.
Examples:
```pycon
>>> f'{-0.1:#x}'
'-0x1.999999999999ap-4'
>>> (-0.1).hex()
'-0x1.999999999999ap-4'
>>> f'{3.14159:+#X}'
'+0X1.921F9F01B866EP+1'
>>> f'{3.14159:.3x}'
'1.922p+1'
```
Minor changes:
* added Py_hexdigits_upper constant
* tests for RaisingNumber are moved (to test also bytes)
0 commit comments