Message407352
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. |
|
Date |
User |
Action |
Args |
2021-11-30 05:11:01 | tim.peters | set | recipients:
+ tim.peters, rhettinger, mark.dickinson, python-dev, serhiy.storchaka, Gideon |
2021-11-30 05:11:01 | tim.peters | set | messageid: <1638249061.73.0.268347058238.issue45917@roundup.psfhosted.org> |
2021-11-30 05:11:01 | tim.peters | link | issue45917 messages |
2021-11-30 05:11:01 | tim.peters | create | |
|