You can type proper fractions (3/4), mixed numbers (1 3/4), whole numbers and decimals. A second calculator turns decimals into fractions, including repeating decimals such as 0.333… or 0.1(6). The arithmetic is exact: fractions are kept as whole numbers on top and bottom, so there is no rounding until the decimal at the end.
How it works
To add or subtract, the fractions need the same denominator. The calculator uses the least common multiple (LCM) of the two denominators, the smallest number both divide into, so the numbers stay small. Each fraction is multiplied top and bottom by whatever takes its denominator to the LCM, then the numerators are added or subtracted. To multiply, multiply the numerators together and the denominators together. To divide, flip the second fraction (its reciprocal) and multiply. A mixed number is turned into an improper fraction first: 1 3/4 = (1 × 4 + 3)/4 = 7/4. The result is simplified by dividing top and bottom by their greatest common divisor (GCD), found with Euclid’s algorithm. If the numerator is larger than the denominator, the whole part is split off to give a mixed number. The decimal is worked out by long division; when a remainder comes back, the digits repeat from there and the repeating block is marked with a bar. For a repeating decimal, the converter takes all the digits up to the end of the first repeating block, subtracts the digits before the block, and divides by as many 9s as the block has digits, followed by one 0 for each digit between the point and the block. So 0.1(6) = (16 − 1)/90 = 15/90 = 1/6.
Worked example
A recipe needs 1 3/4 cups of flour and you add 2/3 cup more. First, 1 3/4 = 7/4. The LCM of 4 and 3 is 12, so 7/4 = 21/12 and 2/3 = 8/12. Then 21/12 + 8/12 = 29/12. The GCD of 29 and 12 is 1, so 29/12 is already in lowest terms. As a mixed number that is 2 5/12 cups, or 2.41666… (2.4167 rounded). Decimal to fraction: 0.375 has three decimal places, so it is 375/1000. The GCD is 125, which gives 3/8. A repeating decimal: 0.333… is 3/9, which simplifies to 1/3.