Tim Peters <t...@python.org> added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue45917>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to