manpagez: man pages & more
info gawk
Home | html | info | man

File: gawk.info,  Node: MPFR Intro,  Prev: MPFR On Parole,  Up: MPFR features

16.3.2 Arbitrary Precision Introduction
---------------------------------------

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 5.2.0, API 3.2, PMA Avon 7, (GNU MPFR 4.0.1, GNU MP 6.1.2)
     -| Copyright (C) 1989, 1991-2022 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 (*note
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
rounding mode are set globally for every operation to follow.  *Note
Setting precision:: and *note Setting the rounding mode:: for more
information.

© manpagez.com 2000-2025
Individual documents may contain additional copyright information.