money round

  • Thread starter Thread starter Steph
  • Start date Start date
S

Steph

hello,
a little problem :
i must do a round number from : 1.125 $ (1 dollar 125)
but Math.Round(1.125, 2) = 1.12 and not 1.13 ...
how do ?

actually i use : Math.Round(1.125+0.0000001, 2) but its not really clean...

thanks
 
Steph said:
a little problem :
i must do a round number from : 1.125 $ (1 dollar 125)
but Math.Round(1.125, 2) = 1.12 and not 1.13 ...
how do ?

actually i use : Math.Round(1.125+0.0000001, 2) but its not really clean...

Use an overload of Math.Round which takes a MidpointRounding parameter.
Oh, and stop using double to represent money - use decimal instead.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Round 3
Math.Round problem 10
Round function? 3
Custom decimal round 14
Round to next value 4
Formula formatting 2
Math.Round down??? 1
VBA code outputs currency value rounded to 2 decimal points 7

Back
Top