summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-25 16:50:05 +0200
committerPaul Buetow <paul@buetow.org>2026-03-25 16:50:05 +0200
commit230f9bd76b721f3633c5c3cebd9c84036cbf9fed (patch)
tree33d3ecd70364ac1bb6071d83ece43d0e7726a769
parent3e12f15a8552ffadb79562cd1279806cef2aab83 (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-xgtbin3687128 -> 3687024 bytes
-rw-r--r--internal/rpn/operations.go7
2 files changed, 4 insertions, 3 deletions
diff --git a/gt b/gt
index 8ee2a94..17acd6a 100755
--- a/gt
+++ b/gt
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
}