Name

round — Returns the integer that is the nearest to the argument.

Synopsis

integer round ( num number );
 

Description

The function returns the number that is closest to the argument and that is an integer. If there are two such numbers, then the one that is closest to positive infinity is returned. If the argument is NaN, then NaN is returned. If the argument is positive infinity, then positive infinity is returned. If the argument is negative infinity, then negative infinity is returned.

Parameters

num

The value to be rounded

Return Types

Examples

Example 24.616. 

The following expressions are true:

round(2.4) = 2
round(2.5) = 3
round(2.6) = 3
round(-2.4) = -3
round(-2.5) = -2
round(-2.6) = -2