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
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