Share via


round Function

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

Returns an integer closest in value to the argument.

Syntax

            number round(number)

Parameters

  • number
    A number.

Return Value

Returns an integer closest in value to the argument.

Remarks

If there are two such numbers, the one that is closest to positive infinity is returned. If the argument is NaN, NaN is returned. If the argument is positive infinity, positive infinity is returned. If the argument is negative infinity, negative infinity is returned. If the argument is positive zero, positive zero is returned. If the argument is negative zero, negative zero is returned. If the argument is less than zero but greater than or equal to -0.5, negative zero is returned.

For the last two cases, the result of calling the round() function is not the same as the result of adding 0.5 and then calling the floor() function because positive zero will be returned in such cases.

The following function call returns 3.

round(2.6)

The following function call returns 2.

round (2.4)

The following function call returns 3.

round(2.5)

The following function call returns –2.

round(-1.6)

The following function call returns –1.

round(-1.5)

See Also

Reference

XPath Number Functions