Author serhiy.storchaka
Recipients mark.dickinson, serhiy.storchaka
Date 2016-01-15.11:42:13
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1452858135.55.0.233335376493.issue26121@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2016-01-15 11:42:15serhiy.storchakasetrecipients: + serhiy.storchaka, mark.dickinson
2016-01-15 11:42:15serhiy.storchakasetmessageid: <1452858135.55.0.233335376493.issue26121@psf.upfronthosting.co.za>
2016-01-15 11:42:15serhiy.storchakalinkissue26121 messages
2016-01-15 11:42:14serhiy.storchakacreate