How to Round of Float values

The following code sample shows how to round off float values. It takes 2 parameters one is the double value,second parameter specifies after how many digts it should be rounded

Math.Round(0.8993333, 2)


Author: Programmer20 May 2008 Member Level: Gold   Points : 2

Math.Round is a function which available in both and javascript.The difference is that in javascript it does not accepts second parameter and converts it into round figure.
For eg,
Math.round(25.9) //returns 26

Author: vivek kushwaha21 May 2008 Member Level: Silver   Points : 2

check this one.

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: