Elamur Research⌕
☰
home / papers / 2007 / MPFR: a multiple-precision binary floating-point library with correct rounding

MPFR: a multiple-precision binary floating-point library with correct rounding

Paper · 2007 · Laurent Fousse, Guillaume Hanrot, Vincent Lefèvre et al.

Summary

Arbitrary-precision floating-point packages such as GMP's MPF, CLN and PARI typically lack precise semantics. Their outputs can shift whenever an internal algorithm changes, which undermines portability and makes correctness proofs impossible. The authors present MPFR, an ISO C library built on the GNU MP (GMP) mpn layer and released under the LGPL. It carries the guarantees of IEEE 754 over to arbitrary precision. Every variable carries its own binary precision, and each operation or mathematical function returns the exact result rounded correctly to the target variable's precision in the requested direction. Exceptions are also supported. The library uses radix 2 so that results are identical on 32- and 64-bit machines and so that the IEEE single, double and quadruple formats can be emulated. Benchmarks show that this rigor comes with little or no speed penalty relative to competing libraries, and MPFR is often faster. The authors also document misrounded results from other packages. MPFR matters because programs built on it inherit well-defined, reproducible arithmetic, and it already supports compilers, computer algebra systems and rigorous mathematical computations.

Key points

  • Each MPFR call returns a ternary "inexact flag" whose sign shows whether the stored result lies below, above or exactly at the true value. Precision can range from 2 bits up to whatever memory allows.
  • Mantissas are stored as arrays of GMP limbs with a leading bit always set. The format has no subnormals and no implicit bit, and unused low-order bits are zero, so a p-bit number uses exactly p bits.
  • Table II reports incorrectly rounded 53-bit results from NTL 5.4, PARI 2.2.12.beta and CLN 1.1.11. One example is a PARI tan x value that is off by about 8.245 ulp.
  • Companion tools include MPFI (interval arithmetic), MPFR++ (a C++ interface), MPC (complex numbers with 16 rounding modes) and MPCHECK (a tester for fixed-precision math libraries).
  • Users include gfortran in GCC-4.0 (for constant folding), Magma, CGAL, a guaranteed LLL implementation, the Fluctuat static analyzer, and rigorous computations of Maass cusp forms and checks of Artin's conjecture.

Our summary of the paper, in our own words — not its text. The work belongs to its authors; read it at the links above.

 Fields, topics and concepts

📚 Shelf 1The field of science this work belongs to (OpenAlex fields).Mathematics · 233 works

Cite

Cite as Laurent Fousse, Guillaume Hanrot, Vincent Lefèvre, Patrick Pélissier and Paul Zimmermann. 2007. MPFR: a multiple-precision binary floating-point library with correct rounding. ACM TOMS 33(2), art. 13.

The paper itself, not this page. BibTeX from the library's record of the work.

@inproceedings{fousse2007mpfr,
  title = {{MPFR: a multiple-precision binary floating-point library with correct rounding}},
  author = {Laurent Fousse, Guillaume Hanrot, Vincent Lefèvre, Patrick Pélissier and Paul Zimmermann},
  booktitle = {ACM TOMS 33(2), art. 13},
  year = {2007},
  url = {https://memsic.ccsd.cnrs.fr/INPL/inria-00070266v1}
}

References

42 references, 0 of them with a card of ours. ↗ leads to the work, «find» searches for one we have no id for yet.

  1. Batut, C., Belabas, K., Bernardi, D., Cohen, H., and Olivier, M. 2000. User’s Guide to PARI/GP. http://pari.math.u-bordeaux.fr/pub/pari/manuals/2.1.6/users.pdf. ↗
  2. Booker, A. R. 2005. Artin’s conjecture, Turing’s method and the Riemann hypothesis. http://www.arxiv.org/abs/math.NT/0507502. 37 pages. — [arXiv:math.nt/0507502](https://arxiv.org/abs/math.nt/0507502) ↗
  3. Booker, A. R., Strömbergsson, A., and Venkatesh, A. 2006. Effective computation of Maass cusp forms. http://www.math.uu.se/ ∼ astrombe/papers/papers.html. Preprint. 29 pages. ↗
  4. Brent, R. P. 1978. A Fortran multiple-precision arithmetic package. ACM Trans. Math. Softw. 4, 1, 57–70. find
  5. Brent, R. P. 1981a. An idealist’s view of semantics for integer and real types. Technical Report TR-CS-81-14, Australian National University, 12 pages. find
  6. Brent, R. P. 1981b. MP user’s guide. Technical Report TR-CS-81-08, Australian National University. 4th edition. 73 pages. find
  7. Char, B. W., Geddes, K. O., Gonnet, G. H., Leong, B. L., Monagan, M. B., and Watt, S. M. 1991. Maple V: Language Reference Manual. Springer-Verlag. find
  8. Clinger, W. D. 1990. How to read floating point numbers accurately. In Proceedings of the ACM SIGPLAN’90 Conference on Programming Language Design and Implementation. White Plains, NY, 92–101. find
  9. Collins, G. E. and Krandick, W. 2000. Multiprecision floating point addition. In Proceedings of the 2000 International Symposium on Symbolic and Algebraic Computation (ISSAC’2000), C. Traverso, Ed. ACM Press, 71–77. find
  10. Cowlishaw, M. 2005. The decNumber C library, 3.32 ed. IBM UK Laboratories. 55 pages. find
  11. Cuyt, A., Kuterna, P., Verdonk, B., and Vervloet, J. 2001. Arithmos: a reliable integrated computational environment. http://www.cant.ua.ac.be/arithmos/index.html. de Dinechin, F., Ershov, A. V., and Gast, N. 2005. Towards the post-ultimate libm. In Proceedings of 17th IEEE Symposium on Computer Ari… ↗
  12. Defour, D., Hanrot, G., Lefèvre, V., Muller, J.-M., Revol, N., and Zimmermann, P. 2004. Proposal for a standardization of mathematical function implementation in floating-point arithmetic. Numerical Algorithms 37, 1-4, 367–375. find
  13. Gay, D. M. 1990. Correctly rounded binary-decimal and decimal-binary conversions. Numerical Analysis Manuscript 90-10, AT&T Bell Laboratories. find
  14. Goubault, E. 2001. Static analyses of the precision of floating-point operations. In Proceedings of SAS’01. Lecture Notes in Computer Science, vol. 2126. Springer-Verlag, 234–259. find
  15. Granlund, T. 2004. GNU MP: The GNU Multiple Precision Arithmetic Library, 4.1.4 ed. http://www.swox.se/gmp/. ↗
  16. Hack, M. 2004. On intermediate precision required for correctly-rounding decimal-to-binary floating-point conversion. In Proceedings of 6th Conference Real Numbers and Computers (RNC’6). Schloss Dagstuhl, Germany. find
  17. Haible, B. and Kreckel, R. 2005. CLN, a class library for numbers. http://www.ginac.de/CLN/. Version 1.1.11. ↗
  18. Haible, B. and Papanikolaou, T. 1997. Fast multiprecision evaluation of series of rational numbers. Technical Report TI-7/97, Darmstadt University of Technology. find
  19. Hanrot, G., Lefèvre, V., Pélissier, P., and Zimmermann, P. 2005. The MPFR library. http://www.mpfr.org/. Version 2.2.0. ↗
  20. Hull, T. E. 1978. Desirable floating-point arithmetic and elementary functions for numerical computation. In Proceedings of the 4th IEEE Symposium on Computer Arithmetic (Arith’4). 63–69. find
  21. IEEE 1985. IEEE standard for binary floating-point arithmetic. ANSI/IEEE Std 754-1985. find
  22. ACM Journal Name, Vol. V, No. N, Month 20YY. find
  23. Kahan, W. 1996. Lecture notes on the status of IEEE standard 754 for binary floating-point arithmetic. http://http.cs.berkeley.edu/ ∼ wkahan/ieee754status/ieee754.ps. 30 pages. ↗
  24. Krandick, W. and Johnson, J. R. 1993. Efficient multiprecision floating point multiplication with optimal directional rounding. In Proceedings of the 11th IEEE Symposium on Computer Arithmetic (Arith’11). Windsor, Ontario. find
  25. Kreinovich, V. and Rump, S. 2006. Towards optimal use of multi-precision arithmetic: A remark. http://www.ti3.tu-harburg.de/ ∼ rump/. 4 pages. ↗
  26. Lefèvre, V. 2004. The generic multiple-precision floating-point addition with exact rounding (as in the MPFR library). In Proceedings of 6th Conference on Real Numbers and Computers (RNC’6). Schloss Dagstuhl, Germany. find
  27. Mulders, T. 2000. On short multiplications and divisions. AAECC 11, 1, 69–88. find
  28. Muller, J.-M. 2005. Elementary Functions. Algorithms and Implementation, 2nd ed. Birk-häuser. find
  29. Müller, N. T. 1997. Towards a real RealRAM: a prototype using C++. In Proc. 6th International Conference on Numerical Analysis. Plovdiv. find
  30. Nguyen, P. and Stehlé, D. 2005. Floating-point LLL revisited. In Proceedings of Eurocrypt 2005. Lecture Notes in Computer Science, vol. 3494. Springer-Verlag, 215–233. find
  31. Priest, D. M. 1991. Algorithms for arbitrary precision floating point arithmetic. In Proceedings of the 10th Symposium on Computer Arithmetic, P. Kornerup and D. Matula, Eds. IEEE Computer Society Press, Grenoble, France, 132–144. find
  32. Revol, N. and Rouillier, F. 2005. MPFI, a multiple precision interval arithmetic library based on MPFR. http://mpfi.gforge.inria.fr/. ↗
  33. Shoup, V. 2005. NTL: A library for doing number theory. http://www.shoup.net/ntl/. Version 5.4. ↗
  34. Smith, D. M. 1991. Algorithm 693. a Fortran package for floating-point multiple-precision arithmetic. ACM Trans. Math. Softw. 17, 2, 273–283. find
  35. Sofroniou, M. and Spaletta, G. 2005. Precise numerical computation. Journal of Logic and Algebraic Programming. Special Issue on Practical Development of Exact Real Number Computation 64, 1, 113–134. find
  36. Steele, G. L. and White, J. L. 1990. How to print floating-point numbers accurately. In Proceedings of the ACM SIGPLAN’90 Conference on Programming Language Design and Implementation. White Plains, NY, 112–126. find
  37. Steele, G. L. and White, J. L. 2003. How to print floating-point numbers accurately. In 20 Years of the ACM/SIGPLAN Conference on Programming Language Design and Implementation (1979-1999): A Selection. Retrospective. 3 pages. find
  38. Sun Microsystems. 2004. Libmcr 0.9 beta: A reference correctly-rounded library of basic double-precision transcendental elementary functions. http://www.sun.com/download/products.xml?id=41797765. ↗
  39. The Arenaire project. 2005. CR-Libm, a library of correctly rounded elementary functions in double-precision. http://lipforge.ens-lyon.fr/projects/crlibm/. Version 0.8. ↗
  40. Verdonk, B., Cuyt, A., and Verschaeren, D. 2001. A precision- and range-independent tool for testing floating-point arithmetic I: Basic operations, square root, and remainder. ACM Trans. Math. Softw. 27, 1, 92–118. find
  41. Wolfram, S. 1996. The Mathematica Book , 3rd ed. Cambridge University Press. find
  42. Ziv, A. 1991. Fast evaluation of elementary mathematical functions with correctly rounded last bit. ACM Trans. Math. Softw. 17, 3, 410–423. find

Updated

↑ back to top

This page in Markdown → https://md.research.elamur.ai/free/en/papers/fousse-2007-mpfr-multiple-precision-binary-floating/