Skip to tool
ecech.
📊 Math & Statistics

One Tenth Plus Two Tenths Is Not Three Tenths in Decimal

Fractions are exact and decimals are not. This keeps integers all the way through and only rounds when it prints.

Exact answer

 

As a decimal

 

Reduced by

 

Decimal to fraction

 

The working, in integers

What your browser does with the same sums in decimal

Advertisement

How the calculation works

The same sum, two ways As fractions 1/10 + 2/10 = 3/10 As decimals 0.1 + 0.2 = 0.30000000000000004 Both are the same question. Only one of them can be stored exactly in binary. A tenth is a repeating fraction in base 2, the way a third is in base 10.

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
The last decimal line is why money is never stored as a float

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.

Advertisement

Frequently Asked Questions

Why does 0.1 + 0.2 not equal 0.3?
Because one tenth cannot be stored exactly in binary, the same way one third cannot be written exactly in decimal. The stored value is slightly off, and adding two of them gives 0.30000000000000004.
How do you add fractions?
Put them over a common denominator and add the numerators: a/b + c/d = (ad + bc) / bd. Then reduce by the greatest common divisor. Every step is integer arithmetic, so nothing is approximated.
How do I simplify a fraction?
Divide both numerator and denominator by their greatest common divisor. For 18/24 the GCD is 6, giving 3/4; for 100/250 it is 50, giving 2/5.
What is 0.4375 as a fraction?
7/16 exactly. That is why it appears on a tape measure and 0.44 does not — imperial rules are divided into sixteenths, and machinists' rules into sixty-fourths.
How do I divide fractions?
Invert the second fraction and multiply: 7/8 divided by 1/4 is 7/8 x 4/1 = 28/8, which reduces to 7/2, or 3 1/2 as a mixed number.
Why is money never stored as a decimal number?
Because rounding breaks. In binary floating point 0.575 x 100 is 57.49999999999999, so rounding to cents gives 57 rather than 58. Financial systems store integer cents or use exact decimal types for exactly this reason.

Related tools in Math & Statistics

Browse all Math & Statistics tools
The desk where ecech. tools get written: a laptop, a notebook of to-dos and a whiteboard listing the tools on the site.

Made by one person

ecech. is not a content farm. Every tool here is written and checked by hand, one at a time, by someone who wanted the tool to exist and could not find a version that showed its working.

No accounts and no sign-in, and nothing you type reaches a server — every calculation on this page runs inside your browser. The ads are served by Google and do set their own cookies, which is set out in full on the privacy page. More about the site.