docs: update README and memory notes

This commit is contained in:
2026-05-02 00:23:11 +02:00
parent 197cbb161c
commit 95eb1d265f
5 changed files with 29 additions and 3 deletions
+3
View File
@@ -0,0 +1,3 @@
- README is more detailed than memory files; keep memory compact.
- Use `state.md` for evolving engine/demo/API details.
- `project.md` should stay as a short pointer file.
+6
View File
@@ -0,0 +1,6 @@
# Project memory
- RPN calculator JS project.
- Read `.memory/state.md` for current state.
- Keep names and commands in English.
- Update memory files based on events: engine, demo, API, commands, exports, docs, or tasks.
+7
View File
@@ -0,0 +1,7 @@
# State
- Core engine: `src/rpn-calculator.js`
- Active demo: `samples/dev/` (HP48-style UI)
- Public API: `push`, `pop`, `clear`, `swap`, `remove`, `edit`, `isValidIndex`, `input`, `command`, `getOperationsByCategory`, `getConstants`
- Config: `maxSize`, `base`, `angleMode`, `enabledCommands`
- Commands: arithmetic, stack, trigonometry, constants `pi` and `e`
- Exports: browser `window.RpnCalculator`, CommonJS `module.exports`
+4
View File
@@ -0,0 +1,4 @@
- Keep `.memory/project.md` short.
- Update `.memory/state.md` after project changes.
- Reconcile README and demo docs if behavior changes.
- Track future work around keyboard UX, stack selection, and command docs.
+9 -3
View File
@@ -22,9 +22,10 @@ The main class is `RpnCalculator`.
- `samples/calc-01/index.html`: active browser demo entry point
- `samples/calc-01/index.css`: demo styles
- `samples/calc-01/index.js`: demo UI and keyboard logic
- `samples/calc-XX/index.html`: active browser demo entry point
- `samples/calc-XX/index.css`: demo styles
- `samples/calc-XX/index.js`: demo UI and keyboard logic
- `samples/calc-01/index.html`: alternate browser demo entry point
- `samples/calc-01/index.css`: alternate demo styles
- `samples/calc-01/index.js`: alternate demo UI and keyboard logic
- `samples/calc-XX/`: placeholder name for future demo variants
## Public API
@@ -129,6 +130,9 @@ calc.command('e');
- `mod` is a percentage operator:
- `a b % => (a * b) / 100`
- `pow` accepts aliases `^` and `y^x`
- `sqrt` accepts alias `sqrt(x)`
- `recip` accepts alias `1/x`
- `div` and `recip` throw `Division by zero` when needed
- `sqrt` throws `Invalid input for sqrt` for negative values
- `asin` and `acos` throw explicit domain errors outside `[-1, 1]`
@@ -138,6 +142,7 @@ calc.command('e');
- `ln` uses `Math.log`
- direct trigonometric functions convert input using `toRadians(...)`
- inverse trigonometric functions convert results back using the current angle mode
- `angleMode` supports `deg`, `rad`, and `grad`
- formatted numeric values are rounded to 12 decimal places
- `-0` is normalized to `0`
- `inputValue` remains a string to preserve future non-decimal input support
@@ -261,6 +266,7 @@ The current demo supports:
- `x`, `y`, `z`, `t`
The demo also implements stack selection and stack-item move mode in its UI layer using the public calculator methods.
It keeps the calculator screen focused and updates the visible stack window as the selection moves.
## Exports