Mark Dickinson added the comment:

> I thought IEEE 754 was supposed to put an end to these sorts of 
> cross-platform differences.

Maybe one day. (Though I'm not holding my breath.)

IEEE 754-2008 does indeed *recommend* (but not actually *require*) correctly 
rounded implementations of all the usual transcendental and power functions 
(including nth root). And if everyone followed those recommendations, then yes, 
the correct rounding would imply that those cross-platform differences would be 
a thing of the past.

I don't see that happening any time soon, though: writing an implementation of 
log (for example) that's provably correctly rounded for all possible inputs is 
much harder than writing an implementation that's simply "almost always" 
correctly rounded (e.g., provably accurate to 0.53 ulps instead of 0.5 ulps), 
and the latter is going to be good enough in the vast majority of contexts. 
Going from "almost always correctly rounded" to "correctly rounded" isn't going 
to have much effect on the overall accuracy of a multistep numerical algorithm, 
so all you're buying (apart from a likely degraded running time) is the 
cross-platform reproducibility, and it's not really clear how useful 
cross-platform reproducibility is as a goal in its own right. Overall, it 
doesn't seem like a good tradeoff.

The pow function is especially hard to make correctly rounded, not least 
because of its two inputs. At least for single-input transcendental functions 
there's some (perhaps remote) hope of doing exhaustive testing on the 18 
million million million possible double-precision inputs; for a function taking 
two inputs that's completely infeasible.

You can take a look at CRlibm [1] for efforts in the direction of a 
correctly-rounded libm; AFAIK it hasn't had wide adoption, and its pow function 
is still work in progress.

[1] http://lipforge.ens-lyon.fr/www/crlibm/

----------

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

Reply via email to