How to Use This Tool
Enter two fractions, optionally with a whole-number part, and pick an operation. Everything is kept as a pair of integers until the moment it is displayed.
Why decimals cannot hold a tenth
Binary floating point stores numbers as sums of powers of two. One half, one quarter and one eighth are exact. One tenth is not — it repeats forever in base 2, exactly as one third repeats forever in base 10, so what gets stored is the nearest available value.
The errors are tiny and they accumulate, and they surface at the worst moment: when something compares a result against a round number.
in a browser, all of these are true: 0.1 + 0.2 = 0.30000000000000004 1/10 + 2/10 = 0.30000000000000004 0.7 + 0.1 = 0.7999999999999999 0.3 - 0.1 = 0.19999999999999998 1/49 x 49 = 0.9999999999999999 0.575 x 100 = 57.49999999999999 as fractions, kept in integers: 1/10 + 2/10 = 3/10 exact 1/3 x 3 = 1 exact 3/4 - 2/3 = 1/12 7/8 / 1/4 = 7/2 = 3 1/2
How exact fraction arithmetic works
Addition puts both fractions over a common denominator, multiplies out, and adds numerators: a/b + c/d = (ad + bc) / bd. Multiplication is simply ac/bd. Division inverts and multiplies. Every step is integer arithmetic, so nothing is ever approximated.
The result is then reduced by the greatest common divisor of numerator and denominator, which is what turns 30/100 into 3/10 and 18/24 into 3/4.
Recipes are fraction arithmetic
Two thirds of a cup times one and a half is exactly one cup. A decimal calculator can return 0.9999999999999999, and more usefully it returns 1.0 without telling you the answer was ever meant to be a clean number. Fractions scale recipes the way the recipe was written: 3/4 x 2/3 is 1/2, not 0.5 repeating to fifteen places.
Tape measures have no decimal markings
An imperial tape is divided into sixteenths, and a machinist's rule into sixty-fourths. A saw setting of 0.4375 in is 7/16, which you can find on the tape; 0.44 in is not on the tape at all. The decimal-to-fraction converter here snaps to whichever denominator you actually own.
Where the exactness ends
Fractions are exact for anything expressible as a ratio of integers. They cannot represent pi, the square root of two, or any other irrational, and repeated arithmetic can make denominators very large before reduction. For measurement and money that is never a problem; for geometry it sometimes is.
