Rounding
math_ceiling¶
Round a float upwards to the nearest integer.
Example¶
ceiling 3.4 # => 4
Arguments¶
- $1 (float): The value to round up
Exit codes¶
- 0: Always
Output on stdout¶
- The ceiling integer value
ceiling¶
Alias for math_ceiling.
math_floor¶
Round a float downwards to the nearest integer (truncate fractional part).
Example¶
floor 3.7 # => 3
Arguments¶
- $1 (float): The value to round down
Exit codes¶
- 0: Always
Output on stdout¶
- The floor integer value
floor¶
Alias for math_floor.
math_trunc¶
Remove the fractional part from a float, returning only the integer portion.
Example¶
trunc 3.7445 # => 3
Arguments¶
- $1 (float): The value to truncate
Exit codes¶
- 0: Always
Output on stdout¶
- Integer portion of the value
trunc¶
Alias for math_trunc.
round¶
Alias for math_round.