15.8.2.6 Math.ceil(x)

2010-07-12

int Math.ceil(x:number|mixed)

If x is an integer, return x, otherwise return the first higher integer from x.

Code: (Meta Ecma)
Math.ceil = function(x){
x = ToNumber(x);
if (isNaN(x)) return NaN;
if (x === +0) return +0;
if (x === -0) return -0;
if (x == +Infinity) return +Infinity;
if (x == -Infinity) return -Infinity;
if (x < 0 && x > -1) return -0;
return Math.ceil(x);
// return (~~x == x) ? x : ~~x+1;
// return -Math.floor(-x);
}