Skip to content
Surf Wiki
Save to docs
general/c-programming-language-libraries

From Surf Wiki (app.surf) — the open knowledge base

GNU MPFR

C library for arbitrary-precision floating-point arithmetic


C library for arbitrary-precision floating-point arithmetic

FieldValue
nameGNU MPFR
titleGNU MPFR
logoMpfr.svg
logo size180px
screenshotGNOME Calculator 41.1.png
captionGNOME Calculator, which uses MPFR as of version 41.1
developerGNU Project (INRIA and others)
released
latest release version
latest release date
latest preview date
programming languageC
operating systemCross-platform
genreMathematical software
licenseLGPL

The GNU Multiple Precision Floating-Point Reliable Library (GNU MPFR) is a GNU portable C library for arbitrary-precision binary floating-point computation with correct rounding, based on GNU Multiple Precision Arithmetic Library.{{cite journal

Library

MPFR's computation is both efficient and has a well-defined semantics: the functions are completely specified on all the possible operands and the results do not depend on the platform. This is done by copying the ideas from the ANSI/IEEE-754 standard for fixed-precision floating-point arithmetic (correct rounding and exceptions, in particular). More precisely, its main features are:

  • Support for special numbers: signed zeros (+0 and −0), infinities and not-a-number (a single NaN is supported: MPFR does not differentiate between quiet NaNs and signaling NaNs).
  • Each number has its own precision (in bits since MPFR uses radix 2). The floating-point results are correctly rounded to the precision of the target variable, in one of the five supported rounding modes (including the four from IEEE 754-1985).
  • Supported functions: MPFR implements all mathematical functions from C99 and other usual mathematical functions: the logarithm and exponential in natural base, base 2 and base 10, the log(1+x) and exp(x)−1 functions (log1p and expm1), the six trigonometric and hyperbolic functions and their inverses, the gamma, zeta and error functions, the arithmetic–geometric mean, the power (xy) function. All those functions are correctly rounded over their complete range.
  • Subnormal numbers are not supported, but can be emulated with the mpfr_subnormalize function.

MPFR is not able to track the accuracy of numbers in a whole program or expression; this is not its goal. Interval arithmetic packages like Arb, MPFI, or Real RAM implementations like iRRAM, which may be based on MPFR, can do that for the user.

MPFR is dependent upon the GNU Multiple Precision Arithmetic Library (GMP).

MPFR is needed to build the GNU Compiler Collection (GCC).{{cite web | access-date=September 25, 2013}} Other software uses MPFR, such as ALGLIB, CGAL, FLINT, GNOME Calculator, the Julia language implementation, the Magma computer algebra system, Maple, GNU MPC, and GNU Octave.

References

References

  1. Higham, Nick. (October 8, 2015). "The Rise of Mixed Precision Arithmetic".
  2. "Frequently asked questions about MPFR: 1. What are the differences between MPF from GMP and MPFR?".
  3. "Arb, a C library for arbitrary-precision ball arithmetic".
  4. "MPFI Project".
  5. "iRRAM, a software library for exact real arithmetic".
Info: Wikipedia Source

This article was imported from Wikipedia and is available under the Creative Commons Attribution-ShareAlike 4.0 License. Content has been adapted to SurfDoc format. Original contributors can be found on the article history page.

Want to explore this topic further?

Ask Mako anything about GNU MPFR — get instant answers, deeper analysis, and related topics.

Research with Mako

Free with your Surf account

Content sourced from Wikipedia, available under CC BY-SA 4.0.

This content may have been generated or modified by AI. CloudSurf Software LLC is not responsible for the accuracy, completeness, or reliability of AI-generated content. Always verify important information from primary sources.

Report