[New-bugs-announce] [issue26121] Use C99 functions in math if available
Serhiy Storchaka
report at bugs.python.org
Fri Jan 15 06:42:15 EST 2016
New submission from Serhiy Storchaka:
Currently the math module uses own implementation of some mathematical functions that are in C99 standard, but not in C89 standard: tgamma, lgamma, erf, erfc. Proposed patch makes it to use functions from standard C library if they are available. They are faster and presumably more accurate.
Here are microbenchmark results (time in microseconds):
0.1 1 3 10 30
erf unpatched: 0.506 0.655 0.509 0.548 0.239
erf patched: 0.129 0.252 0.357 0.253 0.253
erfc unpatched: 0.508 0.646 0.532 0.522 0.251
erfc patched: 0.129 0.239 0.373 0.371 0.307
0.1 1.5 3 10 10.5
gamma unpatched: 0.369 0.279 0.273 0.274 0.457
gamma patched: 0.24 0.23 0.412 0.741 0.682
lgamma unpatched: 0.351 0.338 0.478 0.627 0.52
lgamma patched: 0.217 0.155 0.37 0.372 0.247
If some libm implementations are pretty bad, they can be disabled by undefining corresponding HAVE_XXX macros.
----------
components: Extension Modules
files: math_libc_funcs.patch
keywords: patch
messages: 258288
nosy: mark.dickinson, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Use C99 functions in math if available
type: enhancement
versions: Python 3.6
Added file: http://bugs.python.org/file41623/math_libc_funcs.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26121>
_______________________________________
More information about the New-bugs-announce
mailing list