Comparison of multiple-precision floating-point software

Maple Mathematica Magma SAGE GMP MPF MPFR PARI NTL CLN mpmath
commercial commercial commercial free (GPL) free (LGPL) free (LGPL) free (GPL) free (GPL) free (GPL) free (New BSD)
10.00 6.0.1 2.13-5 2.8.14 4.2.2 2.3.0 2.3.2 5.4.1 1.2.0 0.9
interactive interactive interactive interactive library library library library library library

The following tables give the cpu time in milliseconds spent by several systems or libraries for different operations, at different precisions (in digits). Those timings were obtained on a 16-core AMD Opteron 865 at 1.8GHz (sage.math.washington.edu) with 100GB of swap and 64GB of RAM under Linux 2.6.12-10-amd64-k8-smp. The version of GCC is 4.1.2.

GMP has been built with Gaudry's AMD64 patch. MPFR was built with --with-gmp-build, and make tune. PARI and NTL have been built with native support. CLN has been built with GMP support. The mpmath timings were kindly given by Ondrej Certik, with the script provided by Fredrik Johansson, and were obtained with gmpy enabled (without psyco).

An entry "na" means a function not available in the corresponding software tool. The boldface entries are the fastest in each row.

100 digits Maple Mathematica Magma SAGE MPF MPFR Pari NTL CLN mpmath
mult 0.0048 0.0015 0.0006 0.0012 0.00017 0.00018 0.00017 0.00073 0.00034 0.00843
div 0.0064 0.0029 0.0010 0.0015 0.00064 0.00051 0.00065 0.00121 0.00086 0.01050
sqrt 0.0732 0.0033 0.0015 0.00235 0.00095 0.00086 0.00171 0.00751 0.00106 0.01544
exp 0.164 0.029 0.012 0.014 na 0.011 0.018 0.124 0.035 0.054
log 0.228 0.045 0.0179 0.0220 na 0.0168 0.0287 0.692 0.0475 0.1428
sin 0.280 0.027 0.0159 0.0156 na 0.0121 0.0158 0.137 0.0420 0.0811
cos 0.260 0.028 0.0117 0.0120 na 0.0092 0.0135 0.149 0.0370 0.0815
acos 2.12 0.083 0.235 0.093 na 0.082 0.061 na 0.055 0.421
atan 0.588 0.075 0.201 0.084 na 0.073 0.059 na 0.047 0.516
1000 digits Maple Mathematica Magma SAGE MPF MPFR Pari NTL CLN mpmath
mult 0.0600 0.0088 0.0043 0.0050 0.0046 0.0039 0.0076 0.0247 0.0072 0.0139
div 0.0640 0.0152 0.0087 0.0092 0.0084 0.0082 0.0106 0.0332 0.0119 0.0216
sqrt 0.408 0.0144 0.0076 0.0092 0.0074 0.0074 0.0150 0.311 0.0092 0.0237
exp 2.92 0.668 0.275 0.259 na 0.253 0.674 10.55 0.608 0.456
log 0.800 0.792 0.240 0.242 na 0.232 0.496 85.87 0.633 0.905
sin 5.28 0.428 0.271 0.275 na 0.269 0.621 11.84 0.526 0.793
cos 5.28 0.432 0.263 0.258 na 0.254 0.598 12.57 0.489 0.790
acos 7.38 0.96 2.83 1.10 na 1.06 1.70 na 0.80 2.23
atan 5.36 0.93 2.43 1.00 na 0.97 1.67 na 0.74 2.19
10000 digits Maple Mathematica Magma SAGE MPF MPFR Pari NTL CLN mpmath
mult 1.92 0.232 0.145 0.141 0.167 0.139 0.452 0.974 0.307 0.240
div 1.96 0.504 0.339 0.342 0.342 0.337 0.647 2.763 0.743 0.488
sqrt 9.04 0.332 0.233 0.237 0.236 0.233 0.649 34.06 0.453 0.334
exp 147 20.1 18.8 14.5 na 14.3 45.3 2924 25.9 42.7
log 87.6 17.8 10.5 9.9 na 9.7 29.7 30226 30.3 77.2
sin 295 37.7 24.4 25.6 na 25.5 102 3120 45.7 77.6
cos 295 37.6 24.0 25.2 na 25.0 102 14297 43.9 76.7
acos 246 79.7 219 44.0 na 43.7 117 na 54.8 106.3
atan 251 76.5 187 40.3 na 39.9 116 na 52.8 105.2

The source file of these tests is available for Maple, Mathematica, Magma, SAGE, MPF, MPFR, Pari, NTL, CLN, and mpmath.

Thanks to the National Science Foundation (grant No. 0555776) and to the University of Washington, which provided the machine and software for this comparison.