none
Decimal point control

    Question

  • Whats the best way to control how many numbers to display after the decimal point?

    After i do my math I'm getting an answer of like  17.3226589999 when I just want 17.32

    When i assign it back to my decimal variable i still get 17.3226589999

    Is there something i can do when declaring my variables to control this?

     

    Got to be simple,  Right?

    Thanks

     

     

     

     

     

    Wednesday, May 12, 2010 4:00 PM

Answers

  • If you need that for purposes of displaying data then see this on how to format types .

    In other case use Math.Round().


    This posting is provided "AS IS" with no warranties, and confers no rights.
    Wednesday, May 12, 2010 4:13 PM
    Moderator

All replies

  • If you need that for purposes of displaying data then see this on how to format types .

    In other case use Math.Round().


    This posting is provided "AS IS" with no warranties, and confers no rights.
    Wednesday, May 12, 2010 4:13 PM
    Moderator
  • Ahhh like so:

    Math.Round(17.3226589999,2) would give me 17.32

    Thanks!

     

    • Edited by Rjl66 Wednesday, May 12, 2010 4:38 PM error
    Wednesday, May 12, 2010 4:38 PM