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 (2021) 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 04 | .000 000 05 | .000 000 19 | .000 005 |
* | .000 000 15 | .000 000 26 | .000 003 | .000 166 |
/ | .000 000 18 | .000 000 30 | .000 003 | .000 223 |
sqrt(x) | .000 000 28 | .000 000 45 | .000 010 | .000 269 |
acos(x) | .000 007 | .000 014 | .000 415 | .023 |
acosh(x) | .000 005 | .000 009 | .000 191 | .014 |
asin(x) | .000 007 | .000 012 | .000 409 | .023 |
asinh(x) | .000 005 | .000 009 | .000 177 | .014 |
atan(x) | .000 006 | .000 011 | .000 390 | .022 |
atanh(x) | .000 004 | .000 007 | .000 208 | .014 |
cos(x) | .000 003 | .000 007 | .000 177 | .014 |
cosh(x) | .000 003 | .000 006 | .000 161 | .014 |
exp(x) | .000 004 | .000 008 | .000 180 | .014 |
ln(x) | .000 004 | .000 007 | .000 223 | .013 |
sin(x) | .000 003 | .000 007 | .000 191 | .015 |
sinh(x) | .000 003 | .000 007 | .000 176 | .015 |
tan(x) | .000 004 | .000 008 | .000 194 | .015 |
tanh(x) | .000 005 | .000 009 | .000 181 | .015 |
x ** y | .000 008 | .000 015 | .000 402 | .028 |
beta(x,y) | .000 068 | .000 316 | .011 | 2.2 |
binomial(x,y) | .000 075 | .000 337 | .011 | 2.2 |
c(x) | .000 005 | .000 012 | .000 427 | .039 |
chi(x) | .000 010 | .000 018 | .000 643 | .050 |
ci(x) | .000 008 | .000 018 | .000 645 | .054 |
ei(x) | .000 011 | .000 024 | .000 999 | .083 |
e_1(x) | .000 014 | .000 030 | .001 185 | .091 |
erf(x) | .000 008 | .000 017 | .000 708 | .061 |
erfc(x) | .000 011 | .000 021 | .000 756 | .062 |
gamma(x) | .000 016 | .000 018 | .003 424 | .357 |
igamma1(x,y) | .000 029 | .000 053 | .001 398 | .298 |
igamma2(x,y) | .000 058 | .000 213 | .005 296 | .669 |
j_1(x) | .000 006 | .000 011 | .000 424 | .039 |
li(x) | .000 023 | .000 041 | .001 293 | .098 |
log_gamma(x) | .000 018 | .000 041 | .003 004 | .689 |
psi(x) | .000 014 | .000 035 | .003 672 | .822 |
s(x) | .000 006 | .000 012 | .000 432 | .040 |
shi(x) | .000 005 | .000 010 | .000 402 | .035 |
si(x) | .000 004 | .000 010 | .000 419 | .039 |
y_1(x) | .000 044 | .000 093 | .004 044 | .715 |
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 0.3 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.