Tsair <ts***@myjaring.netwrote:
I found the decimal round up problem,
System.Math.Round(106.865, 2)= 106.86
System.Math.Round(106.875, 2) = 106.88
System.Math.Round(106.885, 2) = 106.88
System.Math.Round(106.895, 2) = 106.9
Why some time it round up the 5 and sometime roun down the 5 ?
Firstly, just to be clear, this is talking about rounding the Double
type, not the Decimal type.
Secondly, this behaviour is as described in the documentation for
Math.Round:
<quote>
Return Value
The number nearest value with a precision equal to digits. If value is
halfway between two numbers, one of which is even and the other odd,
then the even number is returned. If the precision of value is less
than digits, then value is returned unchanged.
</quote>
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog:
http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too