summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-04-11 21:00:24 +0300
committerPaul Buetow <paul@buetow.org>2026-04-11 21:00:24 +0300
commitd28c7cc6ef8f109b8bba498b90d2357466c2195f (patch)
tree74150f6c4b2ba8921ee0898b42b7fae72f060484
parent4efc8d2c03e91ea330cbb9366a60e7405ebca8de (diff)
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
-rw-r--r--internal/rpn/rpn_parse.go4
1 files 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