The GNU Multiple Precision Floating-Point Reliable Library (GNU MPFR) is a
GNU portable
C library for
arbitrary-precision binary
floating-point
In computing, floating-point arithmetic (FP) is arithmetic that represents real numbers approximately, using an integer with a fixed precision, called the significand, scaled by an integer exponent of a fixed base. For example, 12.345 can b ...
computation with
correct rounding, based on
GNU Multi-Precision Library
GNU Multiple Precision Arithmetic Library (GMP) is a free library for arbitrary-precision arithmetic, operating on signed integers, rational numbers, and floating-point numbers. There are no practical limits to the precision except the ones imp ...
.
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
Nan or NAN may refer to:
Places China
* Nan County, Yiyang, Hunan, China
* Nan Commandery, historical commandery in Hubei, China
Thailand
* Nan Province
** Nan, Thailand, the administrative capital of Nan Province
* Nan River
People Given name ...
(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
In a positional numeral system, the radix or base is the number of unique digits, including the digit zero, used to represent numbers. For example, for the decimal/denary system (the most common system in use today) the radix (base number) is t ...
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
Gamma (uppercase , lowercase ; ''gámma'') is the third letter of the Greek alphabet. In the system of Greek numerals it has a value of 3. In Ancient Greek, the letter gamma represented a voiced velar stop . In Modern Greek, this letter re ...
,
zeta and
error function
In mathematics, the error function (also called the Gauss error function), often denoted by , is a complex function of a complex variable defined as:
:\operatorname z = \frac\int_0^z e^\,\mathrm dt.
This integral is a special (non-elementary ...
s, the
arithmetic–geometric mean, the
power (x
y) 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
Accuracy and precision are two measures of ''observational error''.
''Accuracy'' is how close a given set of measurements (observations or readings) are to their ''true value'', while ''precision'' is how close the measurements are to each other ...
of numbers in a whole program or expression; this is not its goal.
Interval arithmetic packages like Arb, MPFI, or
Real RAM
In computing, especially computational geometry, a real RAM (random-access machine) is a mathematical model of a computer that can compute with exact real numbers instead of the binary fixed point or floating point numbers used by most actual comp ...
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).
Other software uses MPFR, such as
ALGLIB,
CGAL
The Computational Geometry Algorithms Library (CGAL) is an open source software library of computational geometry algorithms. While primarily written in C++, Scilab bindings and bindings generated with SWIG (supporting Python and Java for now) ar ...
,
FLINT,
GNOME Calculator
GNOME Calculator, formerly known as gcalctool, is the software calculator integrated with the GNOME desktop environment. It is programmed in C and Vala and part of the GNOME Core Applications.
Views
* ''Basic'' – interface for basic arithmet ...
, the
Julia language
Julia is a high-level, dynamic programming language. Its features are well suited for numerical analysis and computational science.
Distinctive aspects of Julia's design include a type system with parametric polymorphism in a dynamic programmin ...
implementation, the
Magma computer algebra system,
Maple, GNU MPC, and
GNU Octave.
References
External links
Official MPFR web site
{{DEFAULTSORT:Mpfr
C (programming language) libraries
Computer arithmetic
Free software programmed in C
GNU Project software
Numerical libraries
Software using the LGPL license