A fun experimental math library.
Implements exact addition1 and exact multiplication.2
See the file named arithmetic.h.
Implements the Cody-Waite argument reduction algorithm.3
See the files named cw.h and test-reduce-cw.txt.
Implements the Boldo-Daumas-Li exact argument reduction algorithm.4
See the files named reduce.h and test-reduce-bdl.txt.
Implements the Graillat–Langlois–Louvet error-free polynomial evaluation
algorithm.5
See the file polynomial.h.
See the files sin.h, cos.h, sincos.c, and
test-sincos.txt.
- clang or GCC;
- GNU Make;
- GNU MPFR;
- pkg-config;
To install the requirements on Ubuntu:
sudo apt install clang gcc libmpfr-dev make pkg-config
To build and test the argument reduction algorithm:
make test-reduce
./test-reduce cw 2>/dev/null | tee test-reduce-cw.txt
./test-reduce bdl 2>/dev/null | tee test-reduce-bdl.txt
Footnotes
-
Marc Daumas, Laurence Rideau, Laurent Thery. A Generic Library for Floating-Point Numbers and Its Application to Exact Computing. Theorem Proving in Higher Order Logics, 2001, Edinburgh, United Kingdom. pp.169-184. https://hal.science/hal-00157285 ↩
-
Alan H. Karp and Peter Markstein. 1997. High-precision division and square root. ACM Trans. Math. Softw. 23, 4 (Dec. 1997), 561–589. https://dl.acm.org/doi/pdf/10.1145/279232.279237 ↩
-
W. J. Cody and W. Waite, Software manual for elementary functions. Prentice Hall, 1980. ↩
-
Sylvie Boldo, Marc Daumas, and Ren-Cang Li. "Formally verified argument reduction with a fused multiply-add." IEEE Transactions on Computers 58, no. 8 (2008): 1139-1145. https://arxiv.org/pdf/0708.3722 ↩
-
S. Graillat, P. Langlois, and N. Louvet. Algorithms for accurate, validated and fast computations with polynomials. Japan Journal of Industrial and Applied Mathematics, Special issue on Verified Numerical Computation, 2009. ↩