Esote esote.net

math-consts

library for calculating many mathematical constants

My mathematical constants project is a library of C++ templates that work to calculate certain mathematical constants. I use Boost for mathematical functions (such as the Riemann zeta function) and basic constants (such as π). The list of mathematical constants is from this website.

Program was tested with g++. I recommend compiling with the -O3 flag. The library has been tested with C++17, C++14, and C++11. To call a constant, use the following syntax:

All constants have been verified to be accurate to 100 digits with two digits of rounding error, except the following constants:

To avoid rounding error, increase the accuracy of your type. Rounding error does not increase linearly, but rather sub-linearly: going from 100 to 500 digits of accuracy does not quintuple the rounding error, instead it goes from 2 digits to 3 for most constants. Most constants extend to many digits of accuracy without issue, except the Alladi-Grinstead constant, which becomes very slow at higher accuracy (greater than ~100).

I use Catch for unit testing.

The Constants

The Unfinished Constants