Subject | [IBO] Re: Rounding problems |
---|---|
Author | mmenaz |
Post date | 2002-05-17T14:59:05Z |
Theoretically, the Delphi round is better, since with "our" methond we have:
if decimal is:
0 -- > exact number, no rounding
1,2,3,4 --> down
5,6,7,8,9 -> up
So when you do it again and again with different numbers, 4 times on 9 you round down, and 5 times on 9 you round up... at the end you will round up much many times that down.
With Delphi system, 5 is rounded up or down in a "casual" way, so you equally distribute up and down... at the end, you will get a more accurate resoult.
Anyway,without computers, Delphi round it's more difficoult to calculate.
If I remember correct, IBO used the .5 up since a relatively recent release, when Geoff revised all currency management and ended up, with Jason support, to use the same rounding method of Delphi, to avoid confusion and different behaviour.
Regards
Marco Menardi
if decimal is:
0 -- > exact number, no rounding
1,2,3,4 --> down
5,6,7,8,9 -> up
So when you do it again and again with different numbers, 4 times on 9 you round down, and 5 times on 9 you round up... at the end you will round up much many times that down.
With Delphi system, 5 is rounded up or down in a "casual" way, so you equally distribute up and down... at the end, you will get a more accurate resoult.
Anyway,without computers, Delphi round it's more difficoult to calculate.
If I remember correct, IBO used the .5 up since a relatively recent release, when Geoff revised all currency management and ended up, with Jason support, to use the same rounding method of Delphi, to avoid confusion and different behaviour.
Regards
Marco Menardi
--- In IBObjects@y..., "Riho-Rene Ellermaa" <r.ellermaa@h...> wrote:
> I have always thought that rounding is the same accross the world. Less than 0.5 rounds down and 0.5 and bigger rounds up.
> At least that's the way Estonia calculates - in math, banking, etc.
> But I once thought that evryone uses metric system also :)
>
> There are always some countries who want to be different...
>
>