Function floor
pub fn floor(value: DecNum) -> Result<i64, EcoString>
Expand description
Rounds a number down to the nearest integer.
If the number is already an integer, it is returned unchanged.
Note that this function will always return an integer, and will
error if the resulting [float
] or [decimal
] is larger than the maximum
64-bit signed integer or smaller than the minimum for that type.
#calc.floor(500.1)
#assert(calc.floor(3) == 3)
#assert(calc.floor(3.14) == 3)
#assert(calc.floor(decimal("-3.14")) == -4)