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 Gideon, mark.dickinson, python-dev, rhettinger, serhiy.storchaka, tim.peters
Date 2021-11-30.05:11:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1638249061.73.0.268347058238.issue45917@roundup.psfhosted.org>
In-reply-to
Content
Across millions of tries, same thing: Windows exp2 is off by at least 1 ulp over a third of the time, and by over 2 ulp about 3 times per million. Still haven't seen pow(2, x) off by as much as 0.52 ulp.

From its behavior, it appears Windows implements exp2(x) like so:

    i = floor(x)
    x -= i # now 0 <= x < 1
    return ldexp(exp2(x), i)

So it's apparently using some sub-state-of-the-art approximation to 2**x over the domain [0, 1].

But a consequence is that it gets it exactly right whenever x is an integer, so it's unlikely anyone will notice it's sloppy ;-)

I expect we should just live with it.
History
Date User Action Args
2021-11-30 05:11:01tim.peterssetrecipients: + tim.peters, rhettinger, mark.dickinson, python-dev, serhiy.storchaka, Gideon
2021-11-30 05:11:01tim.peterssetmessageid: <1638249061.73.0.268347058238.issue45917@roundup.psfhosted.org>
2021-11-30 05:11:01tim.peterslinkissue45917 messages
2021-11-30 05:11:01tim.peterscreate