DOC

How calculators work

Why 0.1 Is a Strange Number to a Binary Calculator

A finite binary machine cannot represent every finite decimal fraction exactly. The awkwardness begins with numbers as ordinary as 0.1.

Write 0.1 on paper and it looks finished. There is no repeating tail, no ellipsis, no warning label. In a binary arithmetic system, however, 0.1 is usually a repeating fraction. The machine has to choose one of the nearby representable values and carry that choice into later operations.

This is not a calculator making a careless typo. It is a consequence of changing the base of the number system.

Decimal 0.1finite in base 100.000110011001...repeating in base 2

The base decides which fractions fit neatly

In decimal, one tenth is simple because 10 contains the factor 5 and the factor 2. In binary, the only prime factor available is 2. Fractions whose reduced denominators contain other factors keep expanding instead of ending.

Oracle’s classic floating-point guide uses 0.1 as the example: in a binary format, the value lies strictly between two representable floating-point numbers. A finite storage format has to place it on one side or the other, with a small error.

A decimal fraction trying to fit into a repeating binary fraction ladder
The decimal spelling ends. The binary expansion does not.

A rounding decision can become visible later

Suppose a machine stores an approximation to 0.1, then adds it repeatedly. The initial difference may be tiny, but the operation is no longer working with the exact decimal fraction. After enough steps, the accumulated result can land just above or below a display threshold.

exact decimal idea0.1 + 0.1 + 0.1
representation
finite binary worknear 0.3, not identical to it

The size and visibility of this effect depend on the calculator’s internal number system. Some handheld calculators use decimal-coded or fixed-precision techniques rather than the same binary format used by general-purpose programming languages. The safe statement is not “all calculators show the same binary error.” It is that finite digital arithmetic must represent values in a finite set, and some decimal fractions do not fit that set exactly.

Two representable binary values with a decimal 0.1 suspended between them
Rounding is the bridge between a continuous mathematical line and a finite digital set.

Representation has more than one layer

Floating-point formats typically divide a stored value into a sign, an exponent, and a significand. That arrangement gives a wide range with a finite number of meaningful digits. It is excellent for many scientific calculations, but it does not turn every decimal into an exact stored object.

signwhich direction
exponentwhich scale
significandwhich detail
A number decomposed into sign, exponent, and significand cards
The stored format is a compact description, not an infinite decimal transcript.
The strange part of 0.1 is not the number. It is the base used to remember it.

Sources and further reading