[Python-Dev] Cross-platform math functions?

Tim Peters tim.peters at gmail.com
Wed Sep 6 22:44:31 CEST 2006


[Tim Peters]
>> Package a Python wrapper and see how popular it becomes.  Some reasons
>> against trying to standardize on fdlibm were explained here:
>>
>>    http://mail.python.org/pipermail/python-list/2005-July/290164.html

[Andreas Raab]
> Thanks, these are good points. About speed, do you have any good
> benchmarks available?

Certainly not for "typical Python use" -- doubt such a benchmark
exists.  Some people use  sqrt once in a blue moon, others make heavy
use of many libm functions over millions & millions of floats, and in
some apps extremely heavy use is made where speed is everything and
accuracy doesn't much matter at all (e.g., gross plotting).

I'd ask on numeric Python lists, and (e.g.) people working with visualization.

> In my experience fdlibm is quite reasonable for speed in the context of use
> by dynamic languages (i.e., counting allocation overheads, lookup and send
> performance etc)

"Reasonable" for which purpose(s), specifically?  Some people would
certainly care about a 5% slowdown, while most others wouldn't, but
one thing to avoid is pissing off the people who use a thing the most
;-)

> but since I'm not a Python expert I'd appreciate some help with realistic
> benchmarks.

As above, python-dev isn't a likely place to look for such answers.

> ...
> Agreed. Thus my question if someone had already done this ;-)

Not that I know of, although my understanding (which may be wrong) is
that glibc's current math functions started as a copy of fdlibm.


More information about the Python-Dev mailing list