From 4935b8adab236e76220d2f2e06cf72857af834fa Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sun, 24 May 2026 12:43:10 +0300 Subject: 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". --- internal/rpn/operations_arithmetic.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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() -- cgit v1.2.3