Floating-Point Arithmetic & Number Representation

the IEEE 754 standard

/ EYE-triple-E seven-fifty-four /

In the 1970s every computer maker had its own floating-point format, so the same program could give different answers on different machines, and proving anything about numerical software was nearly hopeless. IEEE 754, first published in 1985 and revised since, is the treaty that ended this chaos: it pins down exactly how floating-point numbers are stored, how operations round, and how exceptional cases behave. Today essentially every CPU, GPU and language obeys it, which is why your laptop and a supercomputer agree to the last bit.

The standard fixes the bit layouts (notably binary32 'single' and binary64 'double'), the implicit leading bit and exponent bias, and the special encodings: signed zeros, subnormal numbers for gradual underflow, two infinities, and NaN ('Not a Number'). Crucially it mandates CORRECT ROUNDING for the basic operations: add, subtract, multiply, divide and square root must return the exactly-rounded result, as if computed in infinite precision and then rounded once to the nearest representable value (with ties going to even). It also defines rounding modes and a set of exception flags (invalid, overflow, underflow, division-by-zero, inexact).

This is the reason rounding-error analysis is a science rather than folklore. Because every conforming machine rounds the same way, the standard model fl(x op y) = (x op y)(1 + delta) with |delta| <= u holds with a known u, results are reproducible across hardware, and special values propagate predictably (Inf and NaN flow through a computation instead of crashing it). The standard does NOT promise that long computations are accurate — only that each individual step is impeccable; assembling accurate algorithms from these reliable bricks is still your job.

Compute sqrt(2.0) on any IEEE-754 machine and you get exactly the same 64-bit value, 1.4142135623730951..., because the standard requires sqrt to be correctly rounded. Likewise 1.0/0.0 yields +Inf (with a division-by-zero flag) rather than crashing, and 0.0/0.0 yields NaN.

One treaty, identical bits everywhere — and graceful special values.

IEEE 754 guarantees correct rounding for +, -, *, /, sqrt, but NOT for transcendental functions like sin or exp (the 'table-maker's dilemma'); those may differ in the last bit across libraries.

Also called
IEEE floating-point standardIEEE 754IEEE 浮點數標準