Core Function Truncate
From Sputnik Wiki
Truncate( <expression> )
Contents |
Description
Calculates the integral part of a specified decimal number.
Parameters
expression
Any valid numeric expression.
Return Value
The integral part of expression; that is, the number that remains after any fractional digits have been discarded.
Remarks
Floor() rounds down
Ceiling() rounds up
and Truncate() rounds towards zero.
Thus, Truncate() is like Floor() for positive numbers, and like Ceiling() for negative numbers.
Example
$decimalNumber = 32.7865; // Displays 32 Println(Truncate($decimalNumber)); $decimalNumber = -32.9012; // Displays -32 Println(Truncate($decimalNumber));