From 7982c0988db8b1d5756037ec3488fabd269f8504 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sun, 24 May 2026 12:55:32 +0300 Subject: rpn: fix double-prefix error messages in FastPower toFloat64 already includes the op name in its error message, so wrapping with buildError produced double prefixes like '**: **: value X is not numeric'. - Exponent check: use buildError with plain errors.New - Base check: return toFloat64 error directly (already has context) --- internal/rpn/operations_arithmetic.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/rpn/operations_arithmetic.go b/internal/rpn/operations_arithmetic.go index 314ce99..95fbeab 100644 --- a/internal/rpn/operations_arithmetic.go +++ b/internal/rpn/operations_arithmetic.go @@ -242,7 +242,7 @@ func (o *Operations) FastPower(stack *Stack) error { bVal, err := toFloat64(b, "**") if err != nil { - return buildError("**", fmt.Errorf("exponent must be a number: %w", err)) + return buildError("**", errors.New("exponent must be a number")) } exp := int(bVal) @@ -252,7 +252,7 @@ func (o *Operations) FastPower(stack *Stack) error { aF, err := toFloat64(a, "**") if err != nil { - return buildError("**", err) + return err } // Result is unitless (Cool metric) -- cgit v1.2.3