tkreuzer · GitHub

Bug report

Bug description:

>>> import math
>>> math.ldexp(6993274598585239, -1126)
5e-324
>>>

The correct result would be 1e-323. This is obviously a bug in the Windows ldexp implementation (it works fine on Linux). But it would be good, if it could be fixed on the CPython side with a workaround.
math.ldexp is used by mpmath to round from multiprecision to float, leading to incorrect rounding on Windows.

CPython versions tested on:

3.13

Operating systems tested on:

Windows

Linked PRs

Read the original on github.com ↗