Math.rint | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Math.rint

Why the output of: Math.rint(8.5) ---> 8.0 Math.rint(11.5) ---> 12.0 I think so, the output should be 11.0 like 8.0 but the sololearn compiler is giving 12.0 https://code.sololearn.com/cmRM7T8t9hKR/?ref=app

10th Jul 2019, 2:31 PM
mn121
mn121 - avatar
1 Answer
+ 1
it rounds to the near EVEN integer. this is more accurate round method if you want a round many float.point numbers and get accurate sum of it
10th Jul 2019, 5:36 PM
zemiak