◀ THE FOLD0ROOT.AI // WORLD II · GLITCH · HEISENBUG◆ .dlw.fold
THE FOLD / GLITCH / HEISENBUG / THE DECIMAL VS BINARY

THE DECIMAL VS BINARY

a translation defect, not a precision one
1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION
One tenth has no exact binary representation, for the same reason one third has no exact decimal one. Every currency figure you have ever added in a float was approximate before you touched it.

LIT verified live and exhaustively. All 10,000 sums of two two-decimal values were tested against the exact decimal answer. 2,106 of them disagree — 21.06%. This is not a corner case selected to embarrass the format; it is one sum in five. 0.1 + 0.2 gives 0.30000000000000004, and 0.01 + 0.05 gives 0.060000000000000005.
2 HOW IT WAS WEAVED · AI + HUMAN
This is why financial systems use decimal types or integer cents, and why 0.1 + 0.2 is the most famous three characters in floating point.

AVAN (AI) enumerated the whole space rather than quoting the famous example, because the famous example invites the response that it is a curiosity. 2,106 of 10,000 is not a curiosity. The failure rate is the finding, and the celebrated case is simply one of two thousand.
3 ONE DIMENSION
The full grid. Every red cell is a sum that misses.
4 TWO DIMENSIONS · INTERACTIVE
Pick a pair and see the exact bits you got.
5 THREE DIMENSIONS + AVAN’S INVERSE
The green forward object: a grid mostly right and reliably wrong.
AVAN’s addition (the inverse-companion): the forward reading is that binary floats cannot represent decimal fractions. The inverse is that they represent them perfectly and we are asking the wrong question. The stored value is the exact binary number nearest one tenth, and it is stored, added and returned with total fidelity; what fails is the assumption that a decimal string and a binary float are the same object. Read backwards, this is not a precision defect but a translation one, and it happens at the boundary where a human writes 0.1 and a machine agrees to pretend it heard that.
LIT all 10,000 sums of two two-decimal values tested against the exact decimal answer give 2,106 disagreements - 21.06%, one sum in five and not a corner case selected to embarrass the format - with 0.1 + 0.2 giving 0.30000000000000004 and 0.01 + 0.05 giving 0.060000000000000005

FIG This is why financial systems use decimal types or integer cents, and why 0.1 + 0.2 is the most famous three characters in floating point. AVAN enumerated the whole space rather than quoting the famous example, because the famous example invites the response that it is a curiosity. 2,106 of 10,000 is not a curiosity - the failure rate is the finding, and the celebrated case is simply one of two thousand.
◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of HEISENBUG · David Lee Wise (ROOT0), with AVAN