How do I calculate with decimals?
Type two decimals and pick an operation. The answer is exact (0.1 + 0.2 is 0.3), with the steps you would write by hand.
- Answer
- 16.25
12.5 + 3.75 = 16.25.
- Rounded
- 16.25
- As a fraction
- 65/4
- Working
- Line up the decimal points with 2 decimal places each: 12.50 and 3.75; Add as whole numbers: 1250 + 375 = 1625; Put the decimal point back 2 places from the right: 16.25
- Problem
- 12.5 + 3.75
Answer: 16.25. 12.5 + 3.75 = 16.25.
The working by hand
How to calculate
Adds, subtracts, multiplies, or divides two decimals exactly, shows the working, and rounds the answer to any number of decimal places.
Example with the default inputs (First number 12.5, Operation +, Second number 3.75, Round to (decimal places) 2): 12.5 + 3.75 = 16.25.
Method: Add or subtract: write both numbers with the same number of decimal places and add the whole numbers. Multiply: multiply without the points; the product has as many decimal places as both numbers together. Divide: move both points right until both are whole, then divide.
- Each number is read exactly as typed; there is no rounding in the answer.
- A quotient that does not end is written with a bar over the repeating digits (3.3̅ = 3.333…), or with its first 60 decimal places and "…" if no block repeats by then.
- The rounded answer keeps exactly the chosen number of decimal places; halves round away from zero.
- Dividing by 0 has no answer.
Worked examples
Each example is checked against the calculator on every build.
- First number 12.5, Operation +, Second number 3.75, Round to (decimal places) 1 gives Answer 16.25, Rounded 16.3, As a fraction 65/4, Working Line up the decimal points with 2 decimal places each: 12.50 and 3.75; Add as whole numbers: 1250 + 375 = 1625; Put the decimal point back 2 places from the right: 16.25.Source: Method from OpenStax Prealgebra 2e, section 5.2: https://openstax.org/books/prealgebra-2e/pages/5-2-decimal-operations
- First number 0.1, Operation +, Second number 0.2 gives Answer 0.3, As a fraction 3/10.
- First number 2.5, Operation ×, Second number 0.04 gives Answer 0.1, Working Multiply without the decimal points: 25 × 4 = 100; 1 + 2 = 3 decimal places, so the product is 0.100 = 0.1.
- First number 7.5, Operation ÷, Second number 0.25 gives Answer 30, Working Move both decimal points 2 places to the right: 750 ÷ 25; Divide: 750 ÷ 25 = 30.
- First number 1, Operation ÷, Second number 0.3, Round to (decimal places) 4 gives Answer 3.3̅, Rounded 3.3333, As a fraction 10/3.
- First number 5.2, Operation −, Second number 8.75 gives Answer -3.55, Working Line up the decimal points with 2 decimal places each: 5.20 and 8.75; Subtract as whole numbers: 520 − 875 = -355; Put the decimal point back 2 places from the right: -3.55.
- First number -1.5, Operation ×, Second number -0.3 gives Answer 0.45, Problem -1.5 × (-0.3).
How it works
Each number is read exactly as typed: a sign, digits (commas are allowed only between groups of three digits before the point), an optional decimal point with digits, and an optional exponent e (or E) followed by a whole number from −100 to 100 (2.5e-3 is 0.0025). A point with no digits before or after it is allowed: .5 is 0.5 and 5. is 5. A number with d decimal places is a whole number N over 10^d: 12.5 is 125 ÷ 10, and 3.75 is 375 ÷ 100. All arithmetic is exact with whole numbers of any size.
For a = N₁ ÷ 10^d₁ and b = N₂ ÷ 10^d₂:
- Add or subtract: let d = the larger of d₁ and d₂. Write both with d places: A = N₁ × 10^(d − d₁) and B = N₂ × 10^(d − d₂). Then a ± b = (A ± B) ÷ 10^d.
- Multiply: a × b = (N₁ × N₂) ÷ 10^(d₁ + d₂).
- Divide: with A and B as for adding, a ÷ b = A ÷ B (moving both points d places to the right changes neither value's ratio). b cannot be 0.
The calculator shows:
- Answer: the exact result, without trailing zeros, with a minus sign (a plain hyphen) when negative and no thousands separators. A result that ends is written in full (
16.25,30) when it has at most 60 decimal places; with more it is written in exact e notation: its first significant digit, then (when there are more) a point and the other significant digits with trailing zeros dropped, theneand the power of ten, with a minus sign when it is negative and no plus sign (10^-200 is1e-200, 2^-61 is4.336808689942017736029811203479766845703125e-19). A quotient that repeats is written with each digit of the repeating block followed by a combining overline, U+0305 (3.3̅for 10/3,0.16̅for 1/6). If no block repeats within 60 decimal places, the first 60 decimal places are shown, then…. - Rounded: the result rounded to the chosen number of decimal places (0 to 20), with every place written (
16.250), halves rounded away from zero, and no minus sign on a rounded value of 0. Leave the box empty to hide it. - As a fraction: the result in lowest terms,
numerator/denominator, or a whole number. - Problem: both numbers written the same way as the answer (so
1,234.50is written1234.5), with the operation sign+,−,×or÷between them (a space on each side), and a negative second number in brackets:-1.5 × (-0.3). - Working (steps joined by a semicolon and a space; whole numbers are written without points, a negative second number in brackets):
- Add or subtract, when d is more than 0:
Line up the decimal points with d decimal places each: <a with d places> and <b with d places>; then alwaysAdd as whole numbers: A + B = <A + B>(orSubtract as whole numbers: A − B = <A − B>); then, when d is more than 0,Put the decimal point back d places from the right: <result with d places>, followed by= <answer>when the answer is written differently (trailing zeros dropped, or e notation). "1 decimal place" and "1 place" are singular. - Multiply:
Multiply without the decimal points: N₁ × N₂ = <N₁ × N₂>; then, when d₁ + d₂ is more than 0,d₁ + d₂ = <d₁ + d₂> decimal places, so the product is <product with d₁ + d₂ places>, followed by= <answer>when the answer is written differently (trailing zeros dropped, or e notation). - Divide: when d is more than 0,
Move both decimal points d places to the right: A ÷ B; thenDivide: A ÷ B = <answer>.
- Add or subtract, when d is more than 0:
Assumptions
- The numbers are exact decimals; there is no rounding except in the Rounded line.
- Dividing by 0 has no answer.
Worked examples by hand
12.5 + 3.75. 3.75 has 2 decimal places, so write 12.50 and 3.75. 1250 + 375 = 1625, and the point goes back 2 places from the right: 16.25 (65/4). To 1 place, 16.25 is exactly halfway between 16.2 and 16.3, so it rounds away from zero to 16.3.
0.1 + 0.2. 1 tenth + 2 tenths = 3 tenths: 0.3 exactly (3/10).
2.5 × 0.04. 25 × 4 = 100. 2.5 has 1 decimal place and 0.04 has 2, so the product has 3: 0.100, which is 0.1.
7.5 ÷ 0.25. Move both points 2 places right: 750 ÷ 25 = 30.
1 ÷ 0.3. Move both points 1 place right: 10 ÷ 3 = 3.333…, so the answer is 3.3̅ (10/3), and 3.3333 to 4 places.
5.2 − 8.75. Write 5.20 and 8.75. 520 − 875 = −355, so the answer is −3.55.
−1.5 × (−0.3). 15 × 3 = 45, with 1 + 1 = 2 decimal places: 0.45. A negative times a negative is positive: 0.45.
Other questions people ask
How do I add or subtract decimals?
Line up the decimal points, filling empty places with zeros, then add or subtract as whole numbers and put the point back. 12.5 + 3.75: write 12.50 + 3.75, add 1250 + 375 = 1625, and put the point back two places from the right: 16.25.
How do I multiply decimals?
Multiply the numbers as if there were no decimal points, then count the decimal places in both numbers together; the product has that many. 2.5 × 0.04: 25 × 4 = 100, and 1 + 2 = 3 places gives 0.100, which is 0.1.
How do I divide decimals?
Move the decimal point of both numbers the same number of places to the right until the divisor is a whole number, then divide. 7.5 ÷ 0.25 is the same as 750 ÷ 25 = 30.
Why does 0.1 + 0.2 give 0.3 here but 0.30000000000000004 in some programs?
Many programs store numbers in binary, where 0.1 and 0.2 cannot be written exactly, so a tiny error appears. This calculator keeps every digit you type as an exact decimal, so 0.1 + 0.2 is exactly 0.3.
What does the bar over the digits mean?
A division can give a decimal that never ends. The bar marks the digits that repeat: 1 ÷ 0.3 = 3.3̅, which means 3.333… with the 3 repeating forever.
How does the rounding work?
Pick how many decimal places to keep. The rounded answer writes all of them (16.25 to 3 places is 16.250). A value exactly halfway rounds away from zero: 16.25 to 1 place is 16.3, and −16.25 is −16.3.
Can I type negative numbers or big numbers?
Yes. Type a minus sign for a negative number (−0.75), commas between thousands (1,234.56) if you like, or an exponent such as 2.5e-3 for 0.0025. There is no limit on the number of digits beyond the 60-character box.