summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-05-24 12:43:10 +0300
committerPaul Buetow <paul@buetow.org>2026-05-24 12:43:10 +0300
commit4935b8adab236e76220d2f2e06cf72857af834fa (patch)
tree0213aa1338ffa2f82f0322efc035ee985f269b55
parent2bdc6bb6bddb107c46ead301c0953050ed7acea3 (diff)
rpn: fix double-prefix in logOp error message
buildError(opName, ...) prepends opName to the error, so the inner error should not repeat it. Changed from: buildError(opName, fmt.Errorf("%s undefined...", opName)) to: buildError(opName, errors.New("undefined...")) Produces "lg: undefined for non-positive numbers" instead of "lg: lg undefined for non-positive numbers".
-rw-r--r--internal/rpn/operations_arithmetic.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/internal/rpn/operations_arithmetic.go b/internal/rpn/operations_arithmetic.go
index d0b0798..314ce99 100644
--- a/internal/rpn/operations_arithmetic.go
+++ b/internal/rpn/operations_arithmetic.go
@@ -4,6 +4,7 @@
package rpn
import (
+ "errors"
"fmt"
"math"
)
@@ -319,7 +320,7 @@ func (o *Operations) logOp(stack *Stack, opName string, logFn func(float64) floa
return err
}
if val <= 0 {
- return buildError(opName, fmt.Errorf("%s undefined for non-positive numbers", opName))
+ return buildError(opName, errors.New("undefined for non-positive numbers"))
}
mode := o.GetMode()