Resources » Code Snippets » ASP.NET WebForms

How to Round of Float values

Last Updated:   Category: ASP.NET WebForms    
Author: Member Level: Gold    Points: 10

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)

Did you like this resource? Share it with your friends and show your love!

Responses to "How to Round of Float values"
Author: Programmer    20 May 2008Member 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 kushwaha    21 May 2008Member Level: Silver   Points : 2
check this one.


Post Comment:

  • 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:   Sign In to fill automatically.
    Email: (Will not be published, but required to validate comment)

    Type the numbers and letters shown on the left.

    Submit Article     Return to Article Index

    Subscribe to Subscribers
    Awards & Gifts
    Talk to Webmaster Tony John

    Online Members

    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India