Answers for "math ceil example"

7

math ceil

// There are many ways of rounding...
Math.ceil(5.5) // Answer 6, rounds up.
Math.round(5.5) // Answer 6, rounds to the closest whole number.
Math.floor(5.5) // Answer 5, rounds down.

// ceil is short for ceiling(up), floor is down...
Posted by: Guest on January-06-2022
4

How does Math.ceil work

Math.ceil(x); //This equals the next whole number after x. X must be a double.

//Example use:
x = Math.ceil(x);
//Now x is equal to x rounded up.
Posted by: Guest on May-13-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language