AW: AW: [Mono-list] Maths

Jochen Wezel
Tue, 10 Feb 2004 10:33:03 +0100

Dear Microsoft,

Why are you changing the rounding behaviour from your MS Office products =
(MS Excel is rounding scientific and not like a bank)?
And why - even if you change that behaviour - are you not supporting the =
"old" rounding engine in a separate or overloaded method somewhere in =
the great space of the .NET galaxy?

Most times when I want to round some doubles, they are not currency =
values! They are needed for some program logic and have to been rounded =
"scientific" - I would say "normal". Do all we programmers really have =
to implement our own rounding function again and again?


-----Urspr=FCngliche Nachricht-----
Von: =
[] Im Auftrag von gabor
Gesendet: Dienstag, 10. Februar 2004 09:57
Betreff: Re: AW: [Mono-list] Maths

On Tue, 2004-02-10 at 09:36, Jochen Wezel wrote:
> 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:=20
> always round up every .5 to the next greater integer. Does anybody=20
> know how to do that? System.Math.Round doesn't support any flags to=20
> set up the rounding standard :(

hmm, i'm not a dotnet expert, but this is usually solved by adding 0.5 =
to it and truncating it to an integer.
something like:

Convert.ToInt32( x + 0.5)=20


p.s: pay attention to negative numbers. i'm not sure what behaviour you =
want for negative numbers.


Mono-list maillist  - =