pub fn trunc(value: DecNum) -> StrResult<i64>
Expand description
Returns the integer part of a number.
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.trunc(15.9)
#assert(calc.trunc(3) == 3)
#assert(calc.trunc(-3.7) == -3)
#assert(calc.trunc(decimal("8493.12949582390")) == 8493)