In using Math.rint(4.5) and I am getting the value as 4.0, but when I use Math.round(4.5) I am getting the value as 5. Why is that so?

First time here? Check out the FAQ!

x

0 votes

It's normal to have different results when you are using two different functions. There is also a debate about these functions on various websites.

I have read about it, and there are significant changes in functions. Use the websites listed in Google Search to find out more: https://goo.gl/aWJLI6

I recommend checking the discussion on the Coderanch website.

...