From 54de2315861cdac384183623e1b466f83f397dfc Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sat, 23 May 2026 20:33:41 +0300 Subject: docs: add Log Operators and HyperLog documentation Add Log Operators section documenting lg (log2), log (log10), and ln (natural log) with examples. Add HyperLog operators ([lg], [log], [ln]) to Hyper Operators section with examples and metric behavior notes. Document hyper operator metric behavior: HyperAdd/Subtract/Modulo are metric-aware; HyperMultiply/Divide/Power/HyperLog return Cool. --- README.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'README.md') diff --git a/README.md b/README.md index 44bbea4..53fb640 100644 --- a/README.md +++ b/README.md @@ -369,6 +369,40 @@ gt '100 7 3 [%]' # 100 % 7 % 3 = 2 # → 2 ``` +**Metric behavior:** HyperAdd (`[+]`), HyperSubtract (`[-]`), and HyperModulo (`[%]`) are metric-aware — they convert all operands to compatible units before computing. HyperMultiply (`[*]`), HyperDivide (`[/]`), and HyperPower (`[^]`) always return `Cool` (unitless). + +HyperLog operators compute the sum of logarithms across all stack values: + +```bash +gt '2 4 8 [lg]' # log2(2) + log2(4) + log2(8) = 1 + 2 + 3 = 6 +# → 6 + +gt '10 100 [log]' # log10(10) + log10(100) = 1 + 2 = 3 +# → 3 + +gt '2.718281828 7.389 [ln]' # ln(e) + ln(e²) ≈ 1 + 2 = 3 +# → 3 +``` + +HyperLog operators always return `Cool` (unitless). + +## Log Operators + +Single-value logarithm operators: + +```bash +gt '8 lg' # log₂(8) = 3 +# → 3 + +gt '1000 log' # log₁₀(1000) = 3 +# → 3 + +gt '2.718281828 ln' # ln(e) ≈ 1 +# → 1 +``` + +Log operators return `Cool` (unitless). + ## Metrics Every number on the stack carries a unit of measurement. The default unit is `Cool` (unitless). Numbers with metrics can be converted, combined, and compared with automatic unit handling. -- cgit v1.2.3