Skip to content
Calculators are so ubiquitous and so familiar that they are easy to take for granted in many different ways. [lcamtuf] points out one that has probably never occurred to many of us: the user interface for a calculator is an unexpectedly complex thing.
The internal logic to support sequential inputs and multiple operators in a way that feels intuitive is a complex thing.
Resolving something like 1 + 2 = is pretty straightforward but complexity compounds rapidly after that, with numerous special cases. Let’s imagine one decides to program a simple calculator UI as a weekend project. The development process might look a little like this:
User types in 1 + 2 = and the calculator displays 3. What happens if the user immediately presses -?









