Simple Calculator
A plain calculator for adding, subtracting, multiplying, and dividing, with an AC button, backspace, a plus/minus toggle, and a percent key. It shows the pending operation in a small line above the display. You can click the buttons or type on the keyboard. One thing to know up front: it works like a pocket calculator, so each operator finishes the previous one immediately. It does not apply multiplication-before-addition rules.
How to use the calculator
- Click digits or type them. Numbers are capped at 15 characters, and a second decimal point is ignored.
- Press an operator (+, โ, ร, รท, or %). The first number moves to the small line above the display.
- Enter the second number and press = (or Enter). Pressing another operator instead completes the pending step first and carries the result forward.
- Use ยฑ to flip the sign, โซ to delete the last character, and AC to reset everything.
- Keyboard: digits and ., + - * /, % for percent, Enter or = for the result, Backspace to delete, and Escape or C to clear.
Left-to-right evaluation and the % key
Because each operator resolves the previous one, 2 + 3 ร 4 gives 20, not 14. A calculator with an expression parser would apply precedence and give 14. If you need that, do the multiplication first and then add: 3 ร 4 = 12, then 2 + 12. Division by zero shows an error message and clears the calculator rather than displaying infinity.
The % key here is a binary operator: A % B means A times B divided by 100. Type 200 % 15 = to get 30, which is 15 percent of 200. It does not turn the number on screen into a fraction as some phone calculators do. Results are rounded to 9 decimal places, so 0.1 + 0.2 shows 0.3. Any result longer than 12 characters switches to exponential notation with 6 decimals.