diff options
| author | Paul Buetow <paul@buetow.org> | 2026-03-24 22:36:18 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-03-24 22:36:18 +0200 |
| commit | 67d04283196dcbff59d1eb343e4fc949c329a695 (patch) | |
| tree | 7b20b1b0c6b60620fe8ce804a01104bdafc1d8e7 /README.md | |
| parent | 76cb9d6f40b9d1bd6cd18fd1a0ecdb50bbd12e81 (diff) | |
feat: Add RPN mode, rational number support, and improve REPL
- Add RPN (Reverse Polish Notation) calculator with stack-based operations
- Support precise rational number calculations using *big.Rat
- Implement chain of responsibility pattern for command handling
- Add auto-completion for built-in commands
- Add history persistence with configurable max entries
- Support standard operators: +, -, *, /, ^, %, lg, log, ln
- Support hyper operators: [+], [-], [*], [/], [^], [%], [lg], [log], [ln]
- Support stack manipulation: dup, swap, pop, show
- Support variable assignments and management
- Add rat mode for switching between float64 and rational calculations
- Refactor calculator to return Calculation struct with formatting
- Add proper version support (v0.3.0)
All changes follow Go best practices with comprehensive test coverage.
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 26 |
1 files changed, 26 insertions, 0 deletions
@@ -2,6 +2,32 @@ A simple AI-engineered command-line percentage calculator written in Go. +## Rational Number Mode (Optional) + +The calculator supports precise rational number calculations using Go's `*big.Rat` type. By default, calculations use float64 for performance. + +### Enabling Rational Mode + +In REPL mode, you can switch between float64 and rational number modes: + +``` +> rat on # Enable rational number mode +Rational mode enabled + +> rat off # Disable rational number mode (default) +Rational mode disabled (using float64) + +> rat toggle # Switch to the other mode +Rational mode enabled +``` + +When rational mode is enabled: +- Results are calculated with arbitrary precision +- Output is displayed as a decimal approximation +- Use `rat off` to return to standard float64 calculations + +## Installation + ## Installation ```bash |
