Rounding

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • AdINo
    New Member
    • Oct 2006
    • 11

    Rounding

    Is there a way
    i could convert the number

    63.045

    to 63.05

    ????
  • AdINo
    New Member
    • Oct 2006
    • 11

    #2
    without adding any extra value

    Comment

    • vninja
      New Member
      • Oct 2006
      • 40

      #3
      easiest thing to do is to use the "setprecision(N )" command and have N be a global int const for the desired ammount of decimal places that way you can chage it easier later on when code gets really big and complex n confusing

      Comment

      • emaghero
        New Member
        • Oct 2006
        • 85

        #4
        What you want is to return the ceiling of the number. The ceiling of a number is the
        least integer that is not smaller than x.(CRC Standard Mathematical Tables). For examople the ceiling of pi is 4 etc.

        Comment

        • momotaro
          Contributor
          • Sep 2006
          • 357

          #5
          use "ceil(x)" where x is u rnum! u have to include <math.h>
          ;)

          Comment

          Working...