Calculation history
The calculator records what you have computed in two separate places, and they deliberately do not hold the same thing. The Rust Calculator struct keeps a typed record of the four binary arithmetic operations, storing both operands, which operation was used, and the result. The page keeps its own list of formatted strings that also covers square root, squaring, and factorial. The panel under the keypad displays the five most recent entries from that second list, newest first.
What Rust records
Addition, subtraction, multiplication, and division each append a structured entry to the Rust-side history: the first operand, the second operand, the operation as a typed enum value, and the result, all as a single record. Square root, squaring, and factorial do not append to it, because they are unary and do not fit the two-operand shape of that record. The struct is serialisable, so the whole history can be handed to JavaScript as a plain object when needed.
What the panel shows
The on-screen list is built in the page rather than in Rust, and it covers every operation the keypad can perform, including the unary ones. Entries are formatted the way you would write them by hand, for example “10 × 3 = 30” or “5! = 120”. The panel renders the last five entries in reverse chronological order, so the newest calculation is always at the top, and the counter in the heading shows how many entries exist in total, not just how many are visible.
Clear History empties both lists in one press and resets the counter to zero. It does not touch the display, the working value, or the memory register.
How long history lasts
Both histories live in memory for the lifetime of the page and nowhere else. Reloading the tab rebuilds the Rust Calculator from scratch and starts the on-screen list empty, so there is no way to recover a calculation you made before a refresh. Nothing is written to local storage, to cookies, or to a server, which is the same reason the calculator works with no backend at all.
- Recorded in both histories: addition, subtraction, multiplication, division.
- Recorded only in the on-screen list: square root, squaring, factorial.
- Recorded in neither: memory operations, clearing, and digit entry.
- Cleared by Clear History: both lists and the counter.
- Cleared by a page reload: everything, including the memory register.
Questions and answers
Why does the history counter show more entries than the list?
The panel renders only the five most recent calculations, but the counter reports the total number recorded since the page loaded or since you last pressed Clear History.
Why are square root and factorial missing from the Rust history?
The Rust history record stores two operands and an operation, which only fits the four binary arithmetic operations. Unary operations appear in the on-screen list instead.