Round Function

  • Hi,
     
    I'm not getting the results I expect from the Round function.  I have:
    PRINT ROUND(478/15, 0) and it returns a result of 31, but I expect that it would return 32 because the actual value is 31.8666666666666666666666667 (I just held down the 6 till it looked right, I'm not sure if I have too many or too few, if it matters ).  BOL supports my claim - see ROUND functions, bottom of the page.
     
    It may be nit-picking, but my tester is nit-picky. 
     
    Thanks,
    Melissa
  • Try this:

    ROUND(478.0/15, 0)

    Your example is performing integer division, whereas you want to perform float division and then round.

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

  • Got it, makes sense.  Thank you!

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply