gawk: MPFR features
15.3 Arbitrary-Precision Arithmetic Features in 'gawk'
======================================================
By default, 'gawk' uses the double-precision floating-point values
supplied by the hardware of the system it runs on. However, if it was
compiled to do so, and the '-M' command-line option is supplied, 'gawk'
uses the GNU MPFR (http://www.mpfr.org) and GNU MP (https://gmplib.org)
(GMP) libraries for arbitrary-precision arithmetic on numbers. You can
see if MPFR support is available like so:
$ gawk --version
-| GNU Awk 4.1.2, API: 1.1 (GNU MPFR 3.1.0-p3, GNU MP 5.0.2)
-| Copyright (C) 1989, 1991-2015 Free Software Foundation.
...
(You may see different version numbers than what's shown here. That's
OK; what's important is to see that GNU MPFR and GNU MP are listed in
the output.)
Additionally, there are a few elements available in the 'PROCINFO'
array to provide information about the MPFR and GMP libraries (
Auto-set).
The MPFR library provides precise control over precisions and
rounding modes, and gives correctly rounded, reproducible,
platform-independent results. With the '-M' command-line option, all
floating-point arithmetic operators and numeric functions can yield
results to any desired precision level supported by MPFR.
Two predefined variables, 'PREC' and 'ROUNDMODE', provide control
over the working precision and the rounding mode. The precision and the
Setting precision:: and Setting the rounding mode for more
information.