Share via


round Method

Returns a supplied numeric expression rounded to the nearest integer.

function round(number : Number) : Number

Arguments

  • number
    Required. A numeric expression.

Remarks

The required number argument is the value to be rounded to the nearest integer.

For positive numbers, if the decimal portion of number is 0.5 or greater, the return value is the smallest integer that is greater than number. If the decimal portion is less than 0.5, the return value is the largest integer that is less than or equal to number.

For negative numbers, if the decimal portion is exactly 0.5, the return value is the smallest integer that is greater than the number.

For example, Math.round(8.5) returns 9, but Math.round(-8.5) returns -8.

Requirements

Version 1

Applies To:

Math Object

See Also

Other Resources

Methods

Change History

Date

History

Reason

March 2009

Added information about negative numbers.

Content bug fix.