round

Purpose

Round a number to the nearest whole number.

Syntax

returnedNum = round(numFlt)

returnedNum - type: number
numFlt - type: float

Returns

The whole number nearest the given number.

Remarks

Analogous to the round function in C/C++. Halfway cases round away from zero, so round(3.5) is 4 and round(-3.5) is -4.

Example

@CODE
"output.txt" << round(3.5) << "\n";
@@CODE

Outputs:

4

See Also

Math Functions