[Mono-list] Maths
Marcus
mathpup@mylinuxisp.com
Mon, 9 Feb 2004 19:31:17 -0500
By the way, the more "usual" method of rounding *is* used when rounding occurs
as a result of a format-string conversion, which results in such surprising
output:
Console.WriteLine("{0:n0}", 2.5 ); // prints 3
Console.WriteLine( Math.Round(2.5) ); // prints 2
On Monday 09 February 2004 1:39 pm, Tom Cabanski wrote:
> In the science disciplines, n.5 is rounded to the nearest even integer
> (e.g. 1.5 rounds to 2, 2.5 rounds to 3 and 3.5 rounds to 4). If you
> think about it, that is actually more accurate that always rounding as
> .5 is exactly in the middle and we should round up about half the time
> and down the other half of the time.