*gawk:* Checking for MPFR

15.6 How To Check If MPFR Is Available
======================================
Occasionally, you might like to be able to check if 'gawk' was invoked
with the '-M' option, enabling arbitrary-precision arithmetic. You can
do so with the following function, contributed by Andrew Schorr:
# adequate_math_precision --- return true if we have enough bits
function adequate_math_precision(n)
{
return (1 != (1+(1/(2^(n-1)))))
}
Here is code that invokes the function in order to check if
arbitrary-precision arithmetic is available:
BEGIN {
# How many bits of mantissa precision are required
# for this program to function properly?
fpbits = 123
# We hope that we were invoked with MPFR enabled. If so, the
# following statement should configure calculations to our desired
# precision.
PREC = fpbits
if (! adequate_math_precision(fpbits)) {
print("Error: insufficient computation precision available.\n" \
"Try again with the -M argument?") > "/dev/stderr"
exit 1
}
}