mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 21:33:09 +00:00
d2bee105c9
This changes the behavior of builtin math to floating point by default. If the result of a computation is an integer, then it will be printed as an integer; otherwise it will be printed as a floating point decimal with up to 'scale' digits past the decimal point (default is 6, matching printf). Trailing zeros are trimmed. Values are rounded following printf semantics. Fixes #4478
41 lines
388 B
Text
41 lines
388 B
Text
|
|
####################
|
|
# Validate basic expressions
|
|
1.5
|
|
1.666667
|
|
2
|
|
1
|
|
1.667
|
|
4
|
|
4
|
|
2
|
|
0.5
|
|
49
|
|
0
|
|
4
|
|
-10
|
|
-2
|
|
-8
|
|
|
|
####################
|
|
# Validate some integral computations
|
|
1
|
|
10
|
|
100
|
|
1000
|
|
1000000000000000
|
|
100000000000000
|
|
-1000000000000000
|
|
0
|
|
2
|
|
500000000000000
|
|
|
|
####################
|
|
# Validate how variables in an expression are handled
|
|
1
|
|
2
|
|
-4.5
|
|
-4
|
|
|
|
####################
|
|
# Validate math error reporting
|