Tuesday, January 22, 2008

We all know what Math.floor and Math.ceil do, but do you know the relationship between the two? Or asked another way, how would you implement ceil function using Math.floor (or vice versa)?

Imlementing ceil using Math.floor:-

function ceil(value:Number):Number
{
return -Math.floor(-value);
}

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home