diff options
| author | Paul Buetow <paul@buetow.org> | 2026-05-23 20:33:41 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-05-23 20:33:41 +0300 |
| commit | 54de2315861cdac384183623e1b466f83f397dfc (patch) | |
| tree | f750f316bb26d739c37710b98d4fd04540954271 /README.md | |
| parent | 5f6875c97bebd0c2f677f38e4e06367b0414e182 (diff) | |
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.
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 34 |
1 files changed, 34 insertions, 0 deletions
@@ -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. |
