[Python-Dev] math.fabs redundant? (original) (raw)
Tim Peters tim.peters at gmail.com
Fri Jul 29 17:57:06 CEST 2005
- Previous message: [Python-Dev] math.fabs redundant?
- Next message: [Python-Dev] Pre-PEP: Exception Reorganization for Python 3.0
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
[Skip]
Why does math have an fabs function? Both it and the abs builtin function wind up calling fabs() for floats. abs() is faster to boot.
Nothing deep -- the math module supplies everything in C89's standard libm (+ a few extensions), fabs() is a std C89 libm function.
There isn't a clear (to me) reason why one would be faster than the other; sounds accidental; math.fabs() could certainly be made faster (as currently implemented (via math_1), it endures a pile of general-purpose "try to guess whether libm should have set errno" boilerplate that's wasted (there are no domain or range errors possible for fabs())).
- Previous message: [Python-Dev] math.fabs redundant?
- Next message: [Python-Dev] Pre-PEP: Exception Reorganization for Python 3.0
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]