Rounds a number to the nearest integer.
Parameter |
Description |
value |
A number. See below for special cases. |
Return value |
Description |
double |
The number rounded to the nearest integer, or
to the nearest higher integer if the fraction is 0.5.. |
Usage
Special cases are as follows:
- Rounding
NaN
results in NaN.
- Rounding
+Infinity
results in positive infinity.
- Rounding
-Infinity
results in negative infinity.
- Rounding
Number.MIN_VALUE
or a lesser number
results in zero.
- Rounding
Number.MAX_VALUE
or a greater number
results in the maximum numeric value.
Examples
This edit box
onblur
event
rounds the value of a numeric field.
sessionScope.n = Math.round(sessionScope.n)