Unit content
Floating-point representation
Computers cannot store every real number exactly with a finite number of bits. Floating-point formats approximate a wide range of real values using a sign, a significand and an exponent.
A simplified binary floating-point value has the form
$$(-1)^s,m,2^e,$$
where $s$ determines the sign, $m$ contains a finite number of significant binary digits and $e$ scales the value by a power of two.
Finite precision
Only finitely many significand bits are stored, so most real numbers must be rounded to the nearest representable value.
Even a simple decimal fraction such as $0.1$ has an infinite repeating expansion in binary. It therefore cannot be represented exactly in an ordinary finite binary floating-point format.
Rounding error
A calculation such as
0.1 + 0.2
may produce a stored result extremely close to, but not exactly equal to, the mathematical value $0.3$.
Repeated arithmetic can accumulate or amplify these small representation errors.
Range and special values
Using an exponent allows floating-point numbers to represent both very large and very small magnitudes, but the spacing between representable values grows with magnitude.
Common formats also include representations for positive and negative infinity and for invalid or undefined numerical results, commonly called NaN.
Numerical computation
Floating-point arithmetic is not 'wrong' real arithmetic; it is arithmetic on a finite approximation system. Reliable numerical software therefore considers rounding, scale and tolerance instead of assuming every real-number identity remains exact in machine representation.