Test data
These function times give the average cpu time per call, where many calls were made with arguments
ranging from about 1/500 to 500 in a geometric sequence. See the TOMS 2011 paper for more details.
For functions with restricted domains like asin(x), the values were chosen from the intersection
of the interval ( 1/500 , 500) and the function's domain.
The runs were made on a newer (2016) machine than the one that was used for the 2011 paper.
The faster times here, compared to those in the 2011 paper, are due to faster hardware, as well
as some code-tuning speedups made since 2011.
Precisions in the table range from 50 to 10,000 significant digits.
Times using the gfortran compiler (seconds/call)
50 s.d. | 100 s.d. | 1,000 s.d. | 10,000 s.d. | |
+ or - | .000 000 07 | .000 000 08 | .000 000 45 | .000 006 |
* | .000 000 17 | .000 000 30 | .000 005 | .000 320 |
/ | .000 000 21 | .000 000 34 | .000 005 | .000 330 |
sqrt(x) | .000 000 39 | .000 000 62 | .000 012 | .000 410 |
acos(x) | .000 007 | .000 015 | .000 420 | .033 |
acosh(x) | .000 008 | .000 015 | .000 270 | .021 |
asin(x) | .000 007 | .000 014 | .000 410 | .032 |
asinh(x) | .000 007 | .000 013 | .000 260 | .021 |
atan(x) | .000 006 | .000 013 | .000 390 | .031 |
atanh(x) | .000 005 | .000 011 | .000 240 | .020 |
cos(x) | .000 006 | .000 012 | .000 250 | .022 |
cosh(x) | .000 006 | .000 012 | .000 250 | .022 |
exp(x) | .000 006 | .000 013 | .000 260 | .023 |
ln(x) | .000 006 | .000 011 | .000 230 | .019 |
sin(x) | .000 006 | .000 011 | .000 260 | .023 |
sinh(x) | .000 006 | .000 012 | .000 270 | .023 |
tan(x) | .000 007 | .000 012 | .000 270 | .023 |
tanh(x) | .000 007 | .000 014 | .000 280 | .023 |
x ** y | .000 015 | .000 026 | .000 520 | .043 |
beta(x,y) | .000 073 | .000 160 | .011 | 3.3 |
binomial(x,y) | .000 082 | .000 180 | .012 | 3.4 |
c(x) | .000 018 | .000 037 | .001 500 | .150 |
chi(x) | .000 025 | .000 050 | .001 300 | .078 |
ci(x) | .000 036 | .000 075 | .001 300 | .081 |
ei(x) | .000 030 | .000 071 | .001 900 | .120 |
e_1(x) | .000 032 | .000 070 | .002 300 | .140 |
erf(x) | .000 014 | .000 030 | .001 200 | .130 |
erfc(x) | .000 024 | .000 053 | .002 200 | .400 |
gamma(x) | .000 022 | .000 051 | .003 800 | 1.1 |
igamma1(x,y) | .000 047 | .000 091 | .002 500 | .630 |
igamma2(x,y) | .000 089 | .000 180 | .006 400 | 1.8 |
j_1(x) | .000 018 | .000 042 | .000 990 | .058 |
li(x) | .000 031 | .000 060 | .001 700 | .130 |
log_gamma(x) | .000 024 | .000 048 | .003 700 | 1.1 |
psi(x) | .000 020 | .000 040 | .004 300 | 1.2 |
s(x) | .000 018 | .000 038 | .001 500 | .150 |
shi(x) | .000 017 | .000 027 | .000 900 | .058 |
si(x) | .000 026 | .000 058 | .000 990 | .058 |
y_1(x) | .000 074 | .000 160 | .003 700 | .200 |
Comments
The functions that need Bernoulli numbers are beta, binomial, gamma, both incomplete gammas,
log_gamma, and psi. They use Bernoulli numbers only when precision exceeds 110 to 150
significant digits. Then the first call to one of these functions is usually much slower
than subsequent calls, since the Bernoulli numbers are saved from the first call. These
functions have times over 1 sec/call in the last column of the table, showing that even when
the Bernoulli numbers are available these functions are slower than the other special functions.
Erf(x) and erfc(x) are about equally fast for x < 1, but for the larger values in the range
being tested erf(x) rounds to 1 and is much faster than erfc(x), which must use more terms.