don't NaN & infinities hide FP errors

Tim Peters tim.peters at gmail.com
Wed Nov 17 13:14:34 EST 2004


[Gandalf]
> I still feel that it would be possible to use some assembly code and
> achieve the same behaviour on all platforms.
> It is really not difficult to calculate log on a 387. It can be more
> difficult on a RISC but not impossible.
> Why the implementation stuck on the C standards? Okay, maybe it is
> not possible or too difficult to use asm code on some platforms. But at
> least Python should try to do the same thing when it is possible. It
> could be an 'option' to compile low level code for the most popular
> operating systems. What do you think?

I think you're not burdened by actual experience writing
production-quality math libraries <0.3 wink>.  I've done that for a
living at times, and writing a production-quality math library, even
at the shallow level C89 provides, and even for a single platform, is
a whale of a lot of work.  OTOH, writing low-quality math libraries is
easy.

Python defers to C here because platform C vendors are generally in a much
better position to provide production-quality platform-specific math
libraries than the Python project will ever be.

BTW, "same behavior on all platforms" is a non-goal for me when it
comes to floating point.  There's an enormous range of
speed-vs-accuracy tradeoffs that can be made here, and legitimately
so.  By not trying to force a specific choice here on Python's users,
a Python user that *really* cares about this can get the tradeoff they
like by obtaining (probably buying) and installing a libm replacement
for their platform C libm.  Python will automatically use that too
then.



More information about the Python-list mailing list