Skip to content

Basic Calculator

Perform basic arithmetic operations: addition, subtraction, multiplication, and division with precision

Calculator Details

Result:15See results ↓

Addition, subtraction, multiplication or division

The first number in the calculation

The second number in the calculation

Your Results

Result: 15

Result

15

10 + 5 = 15

Calculation Details

First Number

10

The first operand

Operation

+

Addition

Second Number

5

The second operand

How This Calculator Works

How Basic Arithmetic Works

The calculator does exact decimal arithmetic (Decimal.js), so 0.1 + 0.2 gives 0.3 rather than the 0.30000000000000004 that ordinary binary floating point produces. A division that never ends, like 10 ÷ 3, is rounded to 12 significant digits.

Your calculation (addition)

Formula: a + b = sum

10 + 5 = 15

The four operations

  • Addition combines two numbers: 5 + 3 = 8. Order doesn't matter (a + b = b + a).
  • Subtraction finds the difference: 10 - 4 = 6. Order matters (10 - 4 ≠ 4 - 10).
  • Multiplication is repeated addition: 7 × 6 = 42. Order doesn't matter.
  • Division splits a number into equal parts: 20 ÷ 4 = 5. Dividing by zero is undefined, so the calculator shows an error instead of a result.

Frequently Asked Questions

What is the order of operations (PEMDAS)?

PEMDAS stands for Parentheses, Exponents, Multiplication and Division (left to right), Addition and Subtraction (left to right). This calculator performs one operation at a time, so you control the order. For complex expressions with multiple operations, calculate step by step in PEMDAS order.

Why does division by zero produce an error?

Division by zero is mathematically undefined because there is no number that, when multiplied by zero, gives a non-zero result. For example, 10 ÷ 0 has no valid answer because there's no number x where 0 × x = 10. All calculators and programming languages treat division by zero as an error.

How does this calculator avoid floating-point errors?

This calculator uses Decimal.js, a library for arbitrary-precision decimal arithmetic. Standard floating-point math can produce errors like 0.1 + 0.2 = 0.30000000000000004. Decimal.js keeps numbers as decimal digits rather than binary fractions and does exact decimal arithmetic, ensuring results like 0.1 + 0.2 = 0.3.

What are negative numbers and how do operations work with them?

Negative numbers are less than zero. Adding a negative is like subtracting (5 + (-3) = 2). Subtracting a negative is like adding (5 - (-3) = 8). Multiplying/dividing two negatives gives a positive (-4 × -3 = 12). Multiplying/dividing a positive and negative gives a negative (4 × -3 = -12).

What is the difference between × and * for multiplication?

Both symbols represent multiplication. × is the traditional mathematical symbol, while * is commonly used in programming and on computer keyboards. This calculator displays × for clarity, but they mean the same thing: 5 × 3 and 5 * 3 both equal 15.

How are decimal results rounded?

Addition, subtraction and multiplication are exact. A division that never ends is rounded to 12 significant digits (half up), so 10 ÷ 3 shows 3.33333333333 and 2 ÷ 3 shows 0.666666666667. Round further yourself if you need fewer decimals, e.g. 3.33 to two decimal places.

What is the commutative property?

The commutative property means the order of numbers doesn't change the result. Addition and multiplication are commutative: 3 + 5 = 5 + 3 = 8, and 4 × 6 = 6 × 4 = 24. Subtraction and division are NOT commutative: 10 - 3 ≠ 3 - 10, and 12 ÷ 4 ≠ 4 ÷ 12.

What is the difference between a quotient and a remainder?

In division, the quotient is the whole number result, and the remainder is what's left over. For example, 17 ÷ 5 has quotient 3 and remainder 2 (because 5 × 3 = 15, and 17 - 15 = 2). This calculator shows the decimal quotient (17 ÷ 5 = 3.4), which includes both the whole and fractional parts.

Can I perform calculations with very large or very small numbers?

Yes! This calculator supports numbers from -1,000,000 to 1,000,000, including decimals. Decimal.js can handle even larger numbers with precision, but the interface limits inputs for practical use. For scientific notation or extremely large numbers, use a scientific calculator instead.

Exact decimal arithmetic (Decimal.js) on two numbers between -1,000,000 and 1,000,000. Non-terminating divisions are rounded to 12 significant digits. One operation at a time: no order of operations, powers, roots or memory keys (use the exponent calculator for powers and roots).

Basic Calculator: Exact Decimal Arithmetic and How Rounding Works

By FindMySum · Last reviewed

A basic calculator does four things, addition, subtraction, multiplication and division, and you might assume there is nothing left to explain. The interesting part is the one most calculators hide: how they store numbers. Many computer programs, including most web calculators, do arithmetic in binary floating point, which is why some of them report 0.1 + 0.2 as 0.30000000000000004. This calculator works in exact decimal arithmetic instead, so sums, differences, products and any quotient that terminates are shown exactly, and only a division that never ends is rounded.

Why 0.1 + 0.2 goes wrong elsewhere

Computers normally store numbers in the binary format defined by IEEE 754, the standard behind almost every processor and programming language. In binary, a fraction can only be written exactly if its denominator is a power of 2. One tenth is not: in base 2 it is 0.000110011001100…, repeating forever, in the same way that one third repeats in base 10. A 64-bit floating-point number keeps 53 binary digits, about 15 to 17 significant decimal digits, and rounds the rest. So 0.1 and 0.2 are each stored as a value a hair away from the true one, and the sum shows the error.

For most science and engineering that error is harmless, far smaller than any measurement. For money, and for anyone checking homework, it is confusing. This calculator keeps numbers as decimal digits, so 0.1 + 0.2 = 0.3 exactly, and 19.99 × 3 = 59.97 with no stray digits.

How each operation is handled

  • Addition and subtraction line up the decimal points and work digit by digit, as you would on paper. The result is exact.
  • Multiplication is exact too. The number of decimal places in the product is at most the sum of the decimal places in the two numbers: 4.5 × 2.2 has one plus one, and the product is 9.9.
  • Division is exact when the quotient terminates, as 15.5 ÷ 2.5 = 6.2 does. When it doesn't, the result is rounded half up to 12 significant digits, so 2 ÷ 3 shows 0.666666666667.
  • Division by zero is refused with a message rather than a result, because no number multiplied by 0 gives a non-zero answer.

Each number can be anywhere from −1,000,000 to 1,000,000, with decimals.

Worked example: the calculator's defaults

The calculator opens with addition, a first number of 10 and a second number of 5.

  1. The operation is addition, so the calculator adds 10 + 5.
  2. Both numbers are whole, so there are no decimal places to line up.
  3. The result is 15, shown as the equation 10 + 5 = 15.

Change the operation to division and the second number to 3, and the result becomes 3.33333333333: 10 ÷ 3 is 3.333… repeating, so it is rounded to 12 significant digits, with the 1-digit whole part and 11 decimal places. The equation reads 10 ÷ 3 = 3.33333333333.

Two more examples

  • 0.1 + 0.2 = 0.3. This is the case binary floating point gets wrong; exact decimals get it right.
  • 19.99 × 3 = 59.97. Three items at $19.99 cost exactly $59.97, with nothing to round.

Significant digits and rounding

Twelve significant digits is more than you will need for almost any everyday answer, and more than most handheld calculators show. It is a display limit, not a measure of accuracy. A result can never be more accurate than the numbers you typed: if you divide a length measured to the nearest millimetre, the extra digits after that point carry no information.

NIST's SI guide (SP 811) is a useful reference for writing results: digits are grouped in threes, and the number of digits you keep should reflect the precision of the measurement. In practice, round only once, at the end:

Kind of resultTypical rounding
MoneyTo the cent (2 decimal places)
Lengths with a tape measureTo the nearest millimetre or 1/16 inch
Percentages in a report1 decimal place
Measured lab valuesTo the significant figures of the least precise input

The significant figures calculator rounds to a chosen number of significant figures and explains which digits count.

What it doesn't do

The calculator performs one operation at a time. It doesn't parse a whole expression like 3 + 4 × 2, so it never has to decide the order of operations for you; you do that by choosing which pair of numbers to combine first. It also doesn't keep a running total or memory: to continue, copy the result into one of the boxes. Powers, roots and logarithms live in the exponent and logarithm calculator, and exact fractions such as one third, which a decimal display can only approximate, are better handled by the fraction calculator.

Using the result

For shopping and bills, the percentage calculator, discount calculator, sales tax calculator and tip calculator do the multi-step work for common cases. For a list of numbers rather than two, the average calculator gives the sum and the mean in one go. Every result here is a shareable link, so you can send someone the exact calculation you did.

More questions

Which divisions give a decimal that ends, and which repeat forever?

Write the division as a fraction in lowest terms. If the denominator has no prime factors other than 2 and 5, the decimal ends: 7 ÷ 8 = 0.875 and 3 ÷ 20 = 0.15. If the denominator has any other prime factor, such as 3, 7 or 11, the decimal repeats forever: 1 ÷ 3, 5 ÷ 6 and 2 ÷ 7 all do. The GCF calculator can reduce the fraction for you first.

Why doesn't 10 ÷ 3 then × 3 give back exactly 10?

Because the first result is rounded before you use it again. 10 ÷ 3 is shown as 3.33333333333, and 3.33333333333 × 3 = 9.99999999999, which is exact for the number you typed but one unit short in the last place. Where you can, rearrange the work so the division comes last (10 × 3 ÷ 3), or keep the answer as a fraction with the fraction calculator.

How should I round a result that involves money?

Do the arithmetic at full precision and round once, at the end, to the cent. Rounding each step separately can drift by a cent or more over a long calculation. For tax, the rules for when to round (per item or per invoice) are set by the tax authority and the seller's system, so a receipt can differ from your own total by a cent.

How do I work out a percentage with a basic calculator?

Divide the percentage by 100 and multiply: 15% of 80 is 0.15 × 80 = 12. To find what percentage one number is of another, divide and multiply by 100: 12 ÷ 80 = 0.15, or 15%. For percentage change, discounts and reverse percentages, the percentage calculator does the steps for you.

Why might my phone calculator show a different last digit?

Calculators differ in how many digits they keep and how they round the last one. Some show 8 or 10 digits, some round half to even instead of half up, and many work in binary floating point internally. For a division that never ends, the digits shown agree until the point where one of them stops; beyond that, neither is more correct.

Can I subtract a bigger number from a smaller one?

Yes. The result is negative: 5 − 10 = −5. You can also type negative numbers directly into either box, down to −1,000,000, and the usual sign rules apply to every operation.

Sources

This article explains how the calculator works and is general information, not financial, tax, legal or medical advice. Rules change; check the sources above or a qualified professional before you act.

Spotted a wrong result or a bug? Report a problem

May we count your visits with Invoker Analytics? It keeps a random visitor number in your browser. Your calculator inputs are never sent. Privacy policy