First time here? Check out the FAQ!
x

Mathematical functions information.

0 votes
asked by about BlueJ
edited by

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?

1 Answer

0 votes
answered by (329k points)
edited by

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.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register
...