+ 10

How to differentiate Math.floor from Math.round ?

18th May 2019, 8:34 AM
Hari Gopal
Hari Gopal - avatar
2 ответов
+ 11
think of it in a different light. Floor will always go down to the last integer.The float 3.8 will be dropped down to 3. Round is just that 3.8 will round up to 4. 3.3 will round down to 3.
18th May 2019, 8:38 AM
Mawlood Fareq
Mawlood Fareq - avatar
+ 4
Math.floor - rounds down, Math.ceil - rounds up, Math.round - rounds according to the rules of mathematics
18th May 2019, 8:52 AM
Игорь Яковенко
Игорь Яковенко - avatar