This function returns the value that is closest to the argument and is a mathematical integer. It rounds the input value to the nearest integer value either rounding up or down as necessary.
If the input value is equidistant from two integer values, the result is rounded up towards positive infinity. If the argument is already an integer, the argument itself is returned.
Special boundary conditions that affect the results are:
Note that Math.round(3.5) returns the value 4 while Math.round(-3.5) returns the value 3.
Prev | Home | Next |
Math.random() | Up | Math.sec() |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |