Next: , Previous: , Up: Floating-point Programming   [Contents][Index]

15.2.2 Floating-point Context

A floating-point context defines the environment for arithmetic operations. It governs precision, sets rules for rounding, and limits the range for exponents. The context has the following primary components:


Precision of the floating-point format in bits.


Maximum exponent allowed for the format.


Minimum exponent allowed for the format.

Underflow behavior

The format may or may not support gradual underflow.


The rounding mode of the context.

Table 15.1 lists the precision and exponent field values for the basic IEEE-754 binary formats:

NameTotal bitsPrecisioneminemax

Table 15.1: Basic IEEE Format Context Values

NOTE: The precision numbers include the implied leading one that gives them one extra bit of significand.

A floating-point context can also determine which signals are treated as exceptions, and can set rules for arithmetic with special values. Please consult the IEEE-754 standard or other resources for details.

gawk ordinarily uses the hardware double precision representation for numbers. On most systems, this is IEEE-754 floating-point format, corresponding to 64-bit binary with 53 bits of precision.

NOTE: In case an underflow occurs, the standard allows, but does not require, the result from an arithmetic operation to be a number smaller than the smallest nonzero normalized number. Such numbers do not have as many significant digits as normal numbers, and are called denormals or subnormals. The alternative, simply returning a zero, is called flush to zero. The basic IEEE-754 binary formats support subnormal numbers.

Next: , Previous: , Up: Floating-point Programming   [Contents][Index]