How the arithmetic is done
Each input is parsed into an integer numerator and denominator. A mixed number such as 1 1/2 is converted to an improper fraction (1 × 2 + 1 = 3, so 3/2), a decimal such as 0.75 becomes 75/100, and a whole number gets a denominator of 1. The result is then computed with integer operations:
| Operation | Rule |
|---|---|
| Add | (a × d + c × b) / (b × d) |
| Subtract | (a × d − c × b) / (b × d) |
| Multiply | (a × c) / (b × d) |
| Divide | (a × d) / (b × c), meaning multiply by the reciprocal |
Every result is reduced by dividing numerator and denominator by their greatest common divisor, found with the Euclidean algorithm. The panel shows the simplified fraction, the mixed-number form and the decimal, rounded to at most six places.
Worked examples
- 1 1/2 + 2/3: 3/2 + 2/3 = (9 + 4) / 6 = 13/6 = 2 1/6 ≈ 2.166667.
- 5/6 − 3/4: (20 − 18) / 24 = 2/24, which reduces by 2 to 1/12 ≈ 0.083333.
- 2 1/4 × 2/3: 9/4 × 2/3 = 18/12, which reduces by 6 to 3/2 = 1 1/2.
- 3/4 ÷ 1/2: 3/4 × 2/1 = 6/4 = 3/2.
Input rules and limits
- Mixed numbers need a space between the whole part and the fraction, like
2 1/4. Writing 21/4 means twenty-one quarters. - Negatives go at the front. Type
-1 1/2to mean negative one and a half, with the sign applying to the whole mixed number. A minus inside the fraction, as in 1/-2, is not accepted. - Division by zero is blocked. A zero denominator, or dividing by a fraction equal to zero, shows an error message instead of a result.
- Large values lose precision. The maths uses ordinary JavaScript numbers, so numerators and denominators beyond about 15 digits stop being exact.
- Decimals are converted exactly as typed. The input 0.333 is read as 333/1000, not 1/3, so type 1/3 if you mean one third.
For converting a fraction to a percentage, take the decimal shown here and apply it in the percentage calculator, or move between units of measure with the unit converter.