+ 5

What is the difference between Math.round() and Math.rint() ?

24th Jun 2017, 4:10 PM
Danish Javed
Danish Javed - avatar
3 Answers
+ 3
Also note that when it comes to 0.5, or anything in the middle: rInt() will return the closest even number. round() will return the larger number.
24th Jun 2017, 5:16 PM
Rrestoring faith
Rrestoring faith - avatar
24th Jun 2017, 4:50 PM
Limitless
Limitless - avatar
0
Math.round() Returns an Integer value rounded to closest integer. Math.rint() Returns a Double value rounded to the closest whole number
24th Jun 2017, 4:33 PM
Limitless
Limitless - avatar