You may noticed, .NET uses Banker’s Rounding method other than Arithmetic Rounding. So when .NET runs "int test = Convert.ToInt32(1.5);", the result is 1 other than 2.
Because instead of always rounding up, .NET rounds to then nearest even number
In .NET 1.1, if need arithmetic rounding, try Math.Ceiling.
No comments:
Post a Comment