Skip to content

mansourmoufid/funlibm

Repository files navigation

A fun experimental math library.

Features

Exact floating-point arithmetic

Implements exact addition1 and exact multiplication.2

See the file named arithmetic.h.

Argument reduction

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.

Polynomial evaluation

Implements the Graillat–Langlois–Louvet error-free polynomial evaluation algorithm.5 See the file polynomial.h.

Transcendental functions

Sine and cosine

See the files sin.h, cos.h, sincos.c, and test-sincos.txt.

Requirements

To install the requirements on Ubuntu:

sudo apt install clang gcc libmpfr-dev make pkg-config

Build

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

References

Footnotes

  1. 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

  2. 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

  3. W. J. Cody and W. Waite, Software manual for elementary functions. Prentice Hall, 1980.

  4. 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

  5. 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.

About

A fun experimental math library

Resources

License

Stars

Watchers

Forks