AW: [Mono-list] Maths
Jochen Wezel
jwezel@compumaster.de
Tue, 10 Feb 2004 09:36:05 +0100
Well, I hadn't imagined that there are several rounding standards.=20
Here in Germany I only learned to round up each something.5 to the next =
integer at school.
Now, I've seen the bank rounding which round up and down.=20
But what I want to do is not bank rounding but scientific rounding: =
always round up every .5 to the next greater integer. Does anybody know =
how to do that? System.Math.Round doesn't support any flags to set up =
the rounding standard :(
Jochen
-----Urspr=FCngliche Nachricht-----
Von: Tom Cabanski [mailto:tcabanski@OAI.cc]=20
Gesendet: Montag, 9. Februar 2004 19:40
An: Rodolfo Campero; Jochen Wezel
Cc: mono-list@lists.ximian.com
Betreff: RE: [Mono-list] Maths
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.
This is one of the first platforms that behaves the way I would expect =
in this area.
-------------------------------------
Tom Cabanski
=20
-----Original Message-----
From: Rodolfo Campero [mailto:rodolfocampero@hotmail.com]
Sent: Monday, February 09, 2004 12:29 PM
To: jwezel@compumaster.de
Cc: mono-list@lists.ximian.com
Subject: RE: [Mono-list] Maths
I get the same results with csc from MS .NET 1.0.
>From: "Jochen Wezel" <jwezel@compumaster.de>
>To: <mono-list@lists.ximian.com>
>Subject: [Mono-list] Maths
>Date: Mon, 9 Feb 2004 19:14:20 +0100
>
>Hi!
>
>Has anybody seen that behaviour yet which is produced by MS .Net?
>
>When rounding doubles to integer, there is a rounding error:
> Console.WriteLine(Convert.ToInt32(1.5)) 'is 2 - should be 2
> Console.WriteLine(Convert.ToInt32(2.5)) 'is 2 - should be 3
>
>This may be important for those guys who are programming in that
area...
>
>Jochen
_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*.=20
http://join.msn.com/?page=3Dfeatures/featuredemail
_______________________________________________
Mono-list maillist - Mono-list@lists.ximian.com =
http://lists.ximian.com/mailman/listinfo/mono-list