From d28c7cc6ef8f109b8bba498b90d2357466c2195f Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sat, 11 Apr 2026 21:00:24 +0300 Subject: Fix Float64() return values in test files - operations_test.go: Update Float64() calls to handle (float64, error) return - rpn_parse.go: Update val.Float64() calls in assignment handler - number.go: Add IsString/IsSymbol to Float, Rat, StringNum, Symbol - Fix IsZero() and ToFloat() to use val, _ := Float64() pattern --- internal/rpn/rpn_parse.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/rpn/rpn_parse.go b/internal/rpn/rpn_parse.go index 19e35fa..6659c57 100644 --- a/internal/rpn/rpn_parse.go +++ b/internal/rpn/rpn_parse.go @@ -345,7 +345,7 @@ func (r *RPN) evaluate(input string, tokens []string) (string, error) { if err != nil { return "", fmt.Errorf("insufficient operands for %s: stack is empty", nextToken) } - valF, err := val.Float64() + valF, err := val.Float64() if err != nil { return "", fmt.Errorf("failed to get float64 value for variable %q: %w", token, err) } @@ -355,7 +355,7 @@ func (r *RPN) evaluate(input string, tokens []string) (string, error) { // Skip the operator token (next one) since we handled it inline // We've consumed both tokens, so we're done // Return confirmation message showing the assignment - return fmt.Sprintf("%s = %.10g", token, valF), nil + return fmt.Sprintf("%s = %.10g", token, valF), nil } else if _, err := strconv.ParseFloat(token, 64); err != nil && isValidIdentifier(token) { // This token is a variable name (not a number) shouldPushName = true -- cgit v1.2.3