Z
Zeng
Math.Round has good behavior as following:
Math.Round(3.45, 1); //Returns 3.4. The last '5' is thrown away because 4 is
even
Math.Round(3.75, 1); //Returns 3.8. The last '5' is used because '7' is odd
However, if format.NumberDecimalDigits is 1
decimal d = 3.45M;
d.ToString( "F", format ); //Return 3.5 - this is different from Math.Round;
is this a bug?
d= 3.75M
d.ToString( "F", format) ; //Returns 3.8 - this is the same as Math.Round
Could someone know if I missed anything or I have to do the rounding myself
before using ToString( "F" )?
thanks!
Math.Round(3.45, 1); //Returns 3.4. The last '5' is thrown away because 4 is
even
Math.Round(3.75, 1); //Returns 3.8. The last '5' is used because '7' is odd
However, if format.NumberDecimalDigits is 1
decimal d = 3.45M;
d.ToString( "F", format ); //Return 3.5 - this is different from Math.Round;
is this a bug?
d= 3.75M
d.ToString( "F", format) ; //Returns 3.8 - this is the same as Math.Round
Could someone know if I missed anything or I have to do the rounding myself
before using ToString( "F" )?
thanks!