mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 12:53:13 +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
33 lines
645 B
Text
33 lines
645 B
Text
|
|
####################
|
|
# Validate basic expressions
|
|
|
|
####################
|
|
# Validate some integral computations
|
|
|
|
####################
|
|
# Validate how variables in an expression are handled
|
|
|
|
####################
|
|
# Validate math error reporting
|
|
math: Error: Too few arguments
|
|
'2 - '
|
|
^
|
|
math: Error: Too few arguments
|
|
'ncr(1)'
|
|
^
|
|
math: Error: Expression is bogus
|
|
'max()'
|
|
^
|
|
math: Error: Too few arguments
|
|
'sin()'
|
|
^
|
|
math: Error: Too many arguments
|
|
'2 + 2 4'
|
|
^
|
|
math: Expected at least 1 args, got only 0
|
|
math: Expected at least 1 args, got only 0
|
|
math: Error: Result is infinite
|
|
'2^999999'
|
|
math: Error: Result is infinite
|
|
'1 / 0'
|