floor

Purpose

Round a number down to the nearest whole number.

Syntax

returnedNum = floor(numFlt)

returnedNum - type: number
numFlt - type: float

Returns

The largest whole number that is less than or equal to the given number.

Remarks

Analogous to the floor function in C/C++. Rounds toward negative infinity, so the floor of a negative number moves away from zero. Use truncate to discard the fraction and round toward zero instead.

Example

@CODE
"output.txt" << floor(3.7) << "\n";
@@CODE

Outputs:

3

See Also

Math Functions