Basic calculator
Type the whole expression, with brackets if you like, and the answer appears as you type.
History
Work something out and it collects here.
How it works
This calculator works on whole expressions rather than one step at a time. You can type 12 * (3 + 4) and get the answer straight away, without working out the bracket first.
The order of operations is the usual one: brackets first, then powers, then multiplication and division, and finally addition and subtraction.
A full stop is always a decimal mark. A comma that separates thousands in the usual way, as in 1,000 or 12,500,000, is read as such, so 1,000 + 1 gives 1,001 and 1,000.5 works too; any other comma is a decimal mark, so 2,5 is two and a half. Spaces between digits are also read as thousands separators: 1 000 + 1 gives 1,001 as well.
The per cent sign means hundredths, so 50% is 0.5 and 200 * 10% is 20.
Enter calculates and Escape clears. The answer becomes the starting point for the next calculation, just as on a physical calculator.
Everything is worked out in your browser. The expression is parsed into a tree and evaluated from there, never run as code, so what you type cannot execute anything.
Per cent after plus and minus
When a percentage stands on its own after a plus or a minus, it is taken of everything before it, as on an ordinary pocket calculator. 100 − 30% gives 70, 100 + 25% gives 125, and 50 + 50 + 10% gives 110, because the ten per cent is taken of the sum, 100.
When the percentage is part of a multiplication it is read as hundredths instead. 100 − 2 * 30% therefore gives 99.4, since 2 * 30% is 0.6, and 3 + 4% * 10 gives 3.4.
Numbers side by side
A number written straight before a bracket is multiplied by it: 2(3 + 4) gives 14 and (1 + 2)(3 + 4) gives 21. Two numbers with only a space between them are never multiplied: 2 3 becomes the number 23.
A comma between two whole numbers joins them into a decimal from their written form, so 2,05 is two point nought five rather than 2.5. The exception is a comma with exactly three digits after it that separates thousands in the usual way: 1,050 is one thousand and fifty, not 1.05. A power of ten is written with an e: 1e3 is 1,000.
What is shown and what is stored
The browser calculates with 64-bit binary floating-point numbers, as the JavaScript standard requires. The number 0.1 cannot be stored exactly in binary, so 0.1 + 0.2 is held internally as 0.30000000000000004. The answer is shown to at most twelve significant figures and so reads 0.3, but pressing Enter puts the full stored value into the field.
The same twelve-figure limit applies to large numbers. 123456789012345 is shown as 123,456,789,012,000, where the last three zeros come from the display rather than the calculation. Numbers from a thousand million million upwards, and below a millionth, are shown as powers of ten. Integers above 9,007,199,254,740,991 cannot all be stored exactly, so 9999999999999999 is stored as 10¹⁶ and shown as a power of ten.
Memory, sign and history
M+ adds the current answer to the memory and M− subtracts it. MR types the stored value at the end of the expression and MC clears it. ± changes the sign of the last number, so 3 + 2.5 becomes 3 + (−2.5), and a second press takes the sign off again. ans stands for the answer to the last calculation. The history keeps the last twenty calculations, and clicking a row brings the expression back. Neither the memory nor the history survives reloading the page. The field with the expression and the answer stays in view below the site header while you scroll down to the keys.