D
David Coleman
I am running VS 2003 and have applied SP1. (On WinXP SP2, .Net 1.1)
In the Command Window I get the following
? Math.Round(0.715, 2)
0.72
? Math.Round(0.725, 2)
0.72
? Math.Round(0.735, 2)
0.74
That is not a typo. ? Math.Round(0.725, 2) indeed returns 0.72.
This appears to be the reason I get a 1 cent rounding difference in certain
situations in my code.
The workaround I have implemented is of the form Math.Round(val + 1e-12,
places); however it's pretty ugly.
Help would be appreciated, thanks,
David.
In the Command Window I get the following
? Math.Round(0.715, 2)
0.72
? Math.Round(0.725, 2)
0.72
? Math.Round(0.735, 2)
0.74
That is not a typo. ? Math.Round(0.725, 2) indeed returns 0.72.
This appears to be the reason I get a 1 cent rounding difference in certain
situations in my code.
The workaround I have implemented is of the form Math.Round(val + 1e-12,
places); however it's pretty ugly.
Help would be appreciated, thanks,
David.