# Project rules — RPN Virtual Calculator - Build a browser-friendly RPN calculator as a JavaScript class, preferably in a single file. - Keep code names, categories, and API identifiers in English. - Use only read-only / generic public API methods: `push`, `pop`, `clear`, `swap(index1, index2)`, `remove(index)`, `edit(index)`, `isValidIndex(index)`, `input(command)`, and `command(name, ...args)`. - Expose `inputValue` as a string and `isEditing` as a boolean. - Constructor options: - `maxSize` (default `2048`) - `base` (default `10`) - `angleMode` (`deg` default; also `rad` and `grad`) - `enabledCommands` - Available constants: `pi`, `e`. - Supported operations must be centralized in one dictionary containing at least: - `argCount` - `category` - `aliases` - Allowed categories are limited to: `Stack`, `Arithmetic`, and `Trigonometry`. ## Supported commands - Current commands: - `add`, `sub`, `mul`, `div`, `mod`, `pow`, `sqr`, `neg`, `sqrt`, `recip`, `sin`, `cos`, `tan`, `asin`, `acos`, `atan`, `log`, `ln`, `dup`, `drop`, `swap`, `clear`, `enter` - Aliases: - `+`, `-`, `*`, `/`, `%`, `^`, `y^x`, `1/x` ## Behavior rules - `mod` is the percentage operator: `a b % => (a * b) / 100` - `sqrt`, `asin`, `acos`, `log`, and `ln` must throw clear, explicit domain errors - `log` uses `Math.log10` - `ln` uses `Math.log` - Trigonometric functions use degrees in the demo: - `sin`, `cos`, `tan` convert degrees to radians - inverse trig functions return degrees - `inputValue` must remain a string to preserve future hexadecimal input support - The example HTML must group buttons by `Stack`, `Arithmetic`, and `Trigonometry` - The example HTML must call `command(...)` for actions ## Maintenance - Keep this file updated after each project change using the provided editing tools.