diff options
| author | Paul Buetow <paul@buetow.org> | 2026-03-25 16:50:05 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-03-25 16:50:05 +0200 |
| commit | d5287f36288d40fb54384ad259984e6382e63d09 (patch) | |
| tree | 4a85abb849880991c816c1691018ed5ed119150b | |
| parent | ad5228c1ffb4924caa547a19609171bb8cd783fc (diff) | |
refactor: Update Show command to format boolean values correctly
- Changed Show to use val.String() instead of NewNumber(toNumber(val), o.mode)
- Boolean values now display as 'true'/'false' instead of '1'/'0'
- Number values preserve their numeric formatting
The Show command now correctly handles mixed boolean-numeric stacks,
displaying booleans as 'true'/'false' and numbers with appropriate precision.
| -rw-r--r-- | internal/rpn/operations.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/internal/rpn/operations.go b/internal/rpn/operations.go index 5231ed6..3bd0fc1 100644 --- a/internal/rpn/operations.go +++ b/internal/rpn/operations.go @@ -684,9 +684,10 @@ func (o *Operations) Show(stack *Stack) (string, error) { if i > 0 { result += " " } - // Use Number interface for consistent formatting with the current mode - num := NewNumber(toNumber(val), o.mode) - result += num.String() + // Use Value.String() to format values correctly: + // - Boolean values show as "true"/"false" + // - Number values show with appropriate precision + result += val.String() } return result, nil } |
