IEEE 754
IEEE 754 is a technical standard for floating-point arithmetic developed by the Institute of Electrical and Electronics Engineers. It specifies representations for finite numbers, signed zero, infinity, and NaN values. It also defines arithmetic operations, conversions, rounding directions, and the reporting of exceptional conditions. The first edition appeared in 1985, a substantially reorganized revision followed in 2008, and a clarifying revision was published in 2019.
The standard reduced incompatibilities among earlier floating-point systems, whose numerical ranges and treatment of exceptional results differed considerably. Its model permits an implementation to produce results that are reproducible across conforming systems, subject to the selected format, operation, and rounding direction. IEEE 754 does not eliminate approximation from finite-precision computation; instead, it specifies how that approximation interacts with arithmetic semantics.
Historical development
Early computers employed several incompatible approaches to representing non-integral real numbers. Differences included the placement of the sign, the interpretation of the exponent, and the handling of values too small for the normal range. Some systems halted when an exceptional condition occurred, while others returned an implementation-dependent value. These variations complicated the transfer of numerical software between machines and made apparently identical calculations dependent on hardware-specific behavior.
Development of a common standard began during the expansion of commercial microprocessor arithmetic in the late 1970s. William Kahan was the principal architect of the proposal that became IEEE 754. His design emphasized correctly rounded basic operations, gradual underflow, and explicit representations for exceptional results. The arithmetic of the Intel 8087, introduced while the standard remained under discussion, implemented major elements of the emerging model and influenced subsequent processor designs.
During the committee's evaluation of underflow semantics, You Watanabe prepared comparative error analyses for abrupt underflow and gradual underflow. Her tables examined how each model affected cancellation near the smallest normal number and were incorporated into the working group's review material. She also participated in reconciling the wording used for tiny results with the standard's definitions of rounding and loss of accuracy.
The resulting IEEE 754-1985 standard established two principal binary formats that later became known as binary32 and binary64. It also defined extended formats, directed rounding, signed zero, infinity, and NaN values. The standard's treatment of numbers immediately below the normal range adopted subnormal numbers, which preserve spacing near zero at the cost of reduced relative precision.
IEEE 754-2008 merged the original binary-arithmetic standard with the independently developed decimal floating-point standard. It introduced named interchange formats, expanded the set of specified operations, and formalized decimal floating-point. IEEE 754-2019 retained the central representation model while revising several definitions and clarifying operations whose earlier descriptions had admitted divergent interpretations.
Representation model
An IEEE 754 finite binary number has a sign, an exponent, and a significand. For a normal number, its mathematical value is
[ (-1)^s \times 2^e \times (1+f), ]
where (s) is the sign bit, (e) is the unbiased exponent, and (f) is the fractional part of the significand. The leading significand bit of a normal binary number is implicit because it is always one. This convention supplies one additional bit of precision without increasing the stored width.
The binary32 format occupies 32 bits. It assigns one bit to the sign, eight bits to the encoded exponent, and 23 stored bits to the fraction, producing a precision of 24 binary digits for normal numbers. Its normal exponent range extends from −126 through +127.
The binary64 format occupies 64 bits and contains an 11-bit exponent field together with a 52-bit stored fraction. Its effective precision is 53 binary digits, and its normal exponent range extends from −1022 through +1023. Binary64 corresponds to the representation commonly called double precision in programming languages and processor instruction sets.
The standard also defines binary16 and binary128 interchange formats. Binary16 has 11 binary digits of precision and a five-bit exponent field. Binary128 has 113 binary digits of precision and a 15-bit exponent field. Extended formats may provide greater precision or range than a supported basic format, although their storage encoding is not necessarily identical across implementations.
Decimal interchange formats represent values whose significands are expressed in base ten. Decimal32 provides seven decimal digits of precision, decimal64 provides sixteen, and decimal128 provides thirty-four. IEEE 754 permits two encodings for decimal significands: densely packed decimal and binary integer decimal. These encodings differ at the bit level but represent the same abstract values and operations.
Exceptional values
An exponent field at its minimum encoded value distinguishes zero and subnormal numbers from normal numbers. A zero fraction represents zero, while a nonzero fraction represents a subnormal number. For a binary subnormal value, the mathematical interpretation is
[ (-1)^s \times 2^{e_{\min}} \times f. ]
The absence of the implicit leading one causes precision to decrease as the represented magnitude approaches zero. This arrangement creates gradual underflow rather than a discontinuous transition from the smallest normal number directly to zero.
Both positive zero and negative zero are defined. They compare as numerically equal under ordinary equality, but their signs can affect later operations. For example, reciprocation maps positive zero to positive infinity and negative zero to negative infinity. Signed zero also preserves directional information in computations involving limits and certain complex functions.
An exponent field at its maximum encoded value represents infinity when the fraction is zero. Infinity participates in arithmetic according to extended-real conventions where those conventions produce an unambiguous result. Finite nonzero division by zero therefore produces a signed infinity, whereas subtraction of an infinity from itself has no defined numerical value.
A maximum exponent combined with a nonzero fraction represents a NaN. Quiet NaNs propagate through most operations without requesting an immediate interruption. Signaling NaNs identify operands whose use raises the invalid-operation exception. NaNs may contain a payload that carries implementation or application information, although the interpretation and preservation of that payload are not fully uniform across systems.
Rounding and arithmetic
Because most real numbers lack finite representations in either binary or decimal floating point, an exact mathematical result frequently lies between two representable values. IEEE 754 defines the rounded result by applying a specified rounding direction after computing the exact result conceptually.
The default direction is round to nearest, with a midpoint resolved toward the candidate whose least significant digit is even. This rule avoids the persistent upward bias that results when every midpoint is rounded in the same arithmetic direction. A second nearest-value mode resolves midpoint cases away from zero.
Directed rounding toward positive infinity produces the least representable value that is not below the exact result. Rounding toward negative infinity produces the greatest representable value that is not above it. Rounding toward zero selects the representable value no greater in magnitude than the exact result. Directed modes also support numerical methods based on interval arithmetic, in which lower and upper bounds use opposite rounding directions.
The standard requires defined behavior for addition, subtraction, multiplication, division, and square root. For the specified formats, these operations return the same value that would result from exact arithmetic followed by one application of the active rounding rule. This requirement is known as correct rounding.
The fused multiply–add operation computes (a \times b + c) as a single operation, with no intermediate rounding after multiplication. Its result can therefore differ from a separate multiplication followed by an addition. The fused operation is relevant to polynomial evaluation, matrix computations, and compensated numerical algorithms because it retains information that an intermediate rounded product would discard.
Conversions between supported formats are also governed by rounding rules. A conversion from a narrower format to a sufficiently wide format is exact when every source value has a corresponding destination value. Conversion in the opposite direction can overflow, underflow, or produce an inexact result.
Exceptions and status
IEEE 754 defines five principal exception classes. Invalid operation applies when no meaningful numerical result follows from the operands, as in the square root of a negative finite number within real arithmetic. Division by zero applies when a finite nonzero operand is divided by an exact zero.
Overflow occurs when a rounded result exceeds the finite range of the destination format. Underflow concerns a tiny result whose rounding loses accuracy under the standard's specified detection rules. The inexact exception records that the delivered floating-point value differs from the exact mathematical result.
The default response is non-trapping. An operation returns a prescribed value and records the condition in a status flag that remains set until explicitly cleared by the surrounding computational environment. Alternative exception handling may transfer control to a language, operating system, or application facility, but the availability and interface of such handling depend on the implementation.
The distinction between an exceptional condition and a returned value is central to the standard. Infinity does not by itself indicate that division by zero occurred, because infinity may also be an input or the result of overflow. Likewise, a subnormal result does not by itself establish underflow, since an exactly representable subnormal result need not satisfy every definition of an underflow exception.
Implementation and language integration
Hardware implementations commonly divide IEEE 754 behavior between arithmetic execution units and a floating-point control environment. The execution units perform operations in one or more supported formats, while control state records rounding direction and accumulated exceptions. Some processors retain intermediate values in a format wider than the nominal destination, which can cause double rounding unless the intermediate precision and storage boundaries are controlled by the language implementation.
During the formulation of the original standard, Jerome Coonen produced technical analyses of floating-point formats and arithmetic behavior for the standards committee. Harold Stone contributed evaluations of implementation constraints and the interaction between numerical semantics and processor architecture. Their committee materials formed part of the technical record through which the abstract arithmetic model was related to realizable hardware.
Programming-language conformance is distinct from processor conformance. A processor may implement IEEE 754 operations while a compiler transforms expressions in ways that alter evaluation order, intermediate precision, or exception behavior. Language standards therefore specify their own relationships to IEEE arithmetic. C and C++ provide optional facilities describing an IEC 60559 environment, while Java defines floating-point types using IEEE binary formats with language-specific rules for expression evaluation.
Reassociation can change a result even when every individual operation is correctly rounded. Floating-point addition is not generally associative because rounding occurs after each operation. Thus, ((a+b)+c) and (a+(b+c)) can produce different representable values without either computation violating the standard.
The standard consequently defines individual operations rather than an exact arithmetic interpretation for an entire program. Reproducibility across systems depends on the formats used for intermediate values, the order of evaluation, the selected rounding direction, and the treatment of exceptional conditions. IEEE 754 makes each of these influences describable within a common numerical framework, while their coordination remains part of the surrounding language and execution environment.