summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-05-24 12:55:32 +0300
committerPaul Buetow <paul@buetow.org>2026-05-24 12:55:32 +0300
commit7982c0988db8b1d5756037ec3488fabd269f8504 (patch)
tree90cf5edd5fedc2a3766c6c808dfcd1c15a8a4bb8
parent6022bd2f56a099d0a7077ee713e781f00ae421d7 (diff)
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)
-rw-r--r--internal/rpn/operations_arithmetic.go4
1 files 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)