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 | 230f9bd76b721f3633c5c3cebd9c84036cbf9fed (patch) | |
| tree | 33d3ecd70364ac1bb6071d83ece43d0e7726a769 | |
| parent | 3e12f15a8552ffadb79562cd1279806cef2aab83 (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.
| -rwxr-xr-x | gt | bin | 3687128 -> 3687024 bytes | |||
| -rw-r--r-- | internal/rpn/operations.go | 7 |
2 files changed, 4 insertions, 3 deletions
| Binary files differ 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 } |
