diff options
| author | Paul Buetow <paul@buetow.org> | 2026-05-24 00:08:50 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-05-24 00:08:50 +0300 |
| commit | 1b793d701bce27a39e09db7c924af48b95c1f4a1 (patch) | |
| tree | 2545c8b31f4417154480164acec374b166884a8e | |
| parent | dd2dd420736c38dfcb02d3615d5884463cce2adc (diff) | |
fix(rpn): correct comments in operations_hyper.go
Fix three inaccurate doc comments:
- HyperAdd: remove stale '(with boolean-to-number coercion)' which
is not present in the implementation
- HyperAdd/HyperSubtract/HyperModulo: change 'first operand's metric'
to 'first non-Cool metric (or Cool if all are Cool)' to match the
actual behavior of resultMetricForAdd()
| -rw-r--r-- | internal/rpn/operations_hyper.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/internal/rpn/operations_hyper.go b/internal/rpn/operations_hyper.go index 426b471..34b520b 100644 --- a/internal/rpn/operations_hyper.go +++ b/internal/rpn/operations_hyper.go @@ -11,9 +11,9 @@ import ( // Hyper operators - operate on all values on the stack -// HyperAdd pops all values from stack, adds them left-associative (with boolean-to-number coercion), and pushes result. +// HyperAdd pops all values from stack, adds them left-associative, and pushes result. // Metric-aware: validates all operands share the same category (Cool absorbs), converts to base units for the -// computation, and pushes the result with the first operand's metric. +// computation, and pushes the result with the first non-Cool metric (or Cool if all are Cool). func (o *Operations) HyperAdd(stack *Stack) error { values, err := popAll(stack, "[+]") if err != nil { @@ -89,7 +89,7 @@ func (o *Operations) HyperMultiply(stack *Stack) error { // HyperSubtract pops all values from stack, subtracts them left-associative, and pushes result. // Metric-aware: validates all operands share the same category (Cool absorbs), converts to base units for the -// computation, and pushes the result with the first operand's metric. +// computation, and pushes the result with the first non-Cool metric (or Cool if all are Cool). func (o *Operations) HyperSubtract(stack *Stack) error { values, err := popAll(stack, "[-]") if err != nil { @@ -201,7 +201,7 @@ func (o *Operations) HyperPower(stack *Stack) error { // HyperModulo pops all values from stack, computes modulo left-associative, and pushes result. // Metric-aware: validates all operands share the same category (Cool absorbs), converts to base units for the -// computation, and pushes the result with the first operand's metric. +// computation, and pushes the result with the first non-Cool metric (or Cool if all are Cool). func (o *Operations) HyperModulo(stack *Stack) error { values, err := popAll(stack, "[%]") if err != nil { |
