mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-24 10:07:03 +08: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
42 lines
388 B
Plaintext
42 lines
388 B
Plaintext
|
|
####################
|
|
# 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
|