This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author tim.peters
Recipients mark.dickinson, rhettinger, steven.daprano, tim.peters
Date 2021-11-26.04:10:33
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1637899833.63.0.406951961128.issue45876@roundup.psfhosted.org>
In-reply-to
Content
Note that, on Windows, ldexp() in the presence of denorms can truncate. Division rounds, so

    assert x / 2**i == ldexp(x, -i)

can fail.

>>> import math
>>> d = math.nextafter(0.0, 1.0)
>>> d
5e-324
>>> d3 = 7 * d # .0000...0111
>>> d3
3.5e-323
>>> d3 / 4.0   # rounds
1e-323
>>> math.ldexp(d3, -2)  # truncates
5e-324

or, perhaps more dramatically,

>>> d3 / 8.0, math.ldexp(d3, -3)
(5e-324, 0.0)
History
Date User Action Args
2021-11-26 04:10:33tim.peterssetrecipients: + tim.peters, rhettinger, mark.dickinson, steven.daprano
2021-11-26 04:10:33tim.peterssetmessageid: <1637899833.63.0.406951961128.issue45876@roundup.psfhosted.org>
2021-11-26 04:10:33tim.peterslinkissue45876 messages
2021-11-26 04:10:33tim.peterscreate