[New-bugs-announce] [issue44954] Bug in float.fromhex

Pedro Gimeno report at bugs.python.org
Thu Aug 19 07:34:02 EDT 2021


New submission from Pedro Gimeno <pgpyb-4414 at personal.formauri.es>:

>>> float.fromhex('0x0.8p-1074')
0.0
>>> float.fromhex('0x.8p-1074')
5e-324

One of them is obviously wrong. It's the second one, because:
- The smallest denormal is 0x1p-1074
- Therefore, 0x0.8p-1074 is a tie for rounding purposes.
- The digit in the last place is even because the number is zero, and there is a tie, which implies rounding down.

----------
components: Library (Lib)
messages: 399909
nosy: pgimeno
priority: normal
severity: normal
status: open
title: Bug in float.fromhex
versions: Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44954>
_______________________________________


More information about the New-bugs-announce mailing list