Introduction to MPFR (GNU MPFR 4.2.2)
Description: How to install and use GNU MPFR, a library for reliable multiple precision floating-point arithmetic, version 4.2.2.

## 1 Introduction to MPFR ¶

MPFR is a portable library written in C for arbitrary precision arithmetic on floating-point numbers. It is based on the GNU MP library. It aims to provide a class of floating-point numbers with precise semantics. The main characteristics of MPFR, which make it differ from most arbitrary precision floating-point software tools, are:

- the MPFR code is portable, i.e., the result of any operation does not depend on the machine word size `mp_bits_per_limb` (64 on most current processors), possibly except in faithful rounding. It does not depend either on the machine rounding mode or rounding precision;
- the precision in bits can be set exactly to any valid value for each variable (including very small precision);
- MPFR provides the four rounding modes from the IEEE 754-1985 standard, plus away-from-zero, as well as for basic operations as for other mathematical functions. Faithful rounding (partially supported) is provided too, but the results may no longer be reproducible.

In particular, MPFR follows the specification of the IEEE 754 standard, currently IEEE 754-2019 (which will be referred to as IEEE 754 in this manual), with some minor differences, such as: there is a single NaN, the default exponent range is much wider, and subnormal numbers are not implemented (but the exponent range can be reduced to any interval, and subnormals can be emulated). For instance, computations in the binary64 format (a.k.a. double precision) can be reproduced by using a precision of 53 bits.

This version of MPFR is released under the GNU Lesser General Public License, version 3 or any later version. It is permitted to link MPFR to most non-free programs, as long as when distributing them the MPFR source code and a means to re-link with a modified MPFR library is provided.

### 1.1 How to Use This Manual ¶

Everyone should read MPFR Basics. If you need to install the library yourself, you need to read Installing MPFR, too. To use the library you will need to refer to MPFR Interface.

The rest of the manual can be used for later reference, although it is probably a good idea to glance through it.