Math.round() Function
Name
Math.round() Function---round to the nearest integer
Navigator 2.0, Internet Explorer 3.0
Synopsis
- x
-
Any number or numeric expression
The integer closest to x.
Math.round() rounds its argument up or down to the
nearest integer.
In Navigator 2.0, Math.round()
did not correctly round very large numbers. The following workaround
can be used:
function my_round(num)
{
var fl =index.html Math.floor(num);
var ce = Math.ceil(num);
return (fl == ce) ? num :
((num - fl) < (num - ce)) ? fl :
ce;
}
file: /Techref/language/java/script/definitive/refp_240.htm,
4KB, , updated: 2019年10月14日 16:00, local time: 2025年10月7日 18:04,
©2025 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE.
Questions?<A HREF="http://techref.massmind.org/techref/language/java/script/definitive/refp_240.htm"> [Chapter 21] Reference: Math.round()</A>
Did you find what you needed?
Welcome to massmind.org!
Welcome to techref.massmind.org!
.