Computer Science, asked by cacoon9555, 1 year ago

difference between math.round and math.rint

Answers

Answered by megha250
19

Answer:

Math.rint:-

Returns the double value that is closest in the value to the argument and is equal to mathematical integers.

Math,round:-

returns the closest into the argument.The result is rounded by an integers by adding 1/2, taking the floor of results and casting the results to type int.Special cases if the argument is NaN then the result is 0.

Answered by 919348620122
0

Explanation:

The Java Math rint() method returns a value that is closest to the specified value and is equal to the mathematical integer. That is, if the specified value is 5.8, the closest value that is equal to the mathematical integer is 6.0.

round() is a built-in math function which returns the closest long to the argument. The result is rounded to an integer by adding 1/2, taking the floor of the result after adding 1/2, and casting the result to type long. If the argument is NaN, the result is 0.

Similar questions