Subject | Re: [ib-support] bcd currency rounding pb |
---|---|
Author | Martijn Tonies |
Post date | 2002-08-19T11:13:57Z |
Hi,
"round" - however, always rounding .5 up doesn't distribute the "left
overs" in
the right way.
Delphi uses "bankers rounding" - always round to the nearest even integer.
Hence, .125 will end up .12 while .135 will end up .14 - this is a way of
rounding that (more) evenly distributes the left over values.
Martijn Tonies
InterBase Workbench - the developer tool for InterBase and Firebird
http://www.interbaseworkbench.com
Upscene Productions
http://www.upscene.com
"This is an object-oriented system.
If we change anything, the users object."
> I've seen some bulletins on the subject rounding bcd fields, but can'tuse
> figure exactly what to do :
> We have an application developed with D5, Firebird 1.0, IBX 5.03 sp1 and
> for all currency fields numeric(15, 3).What makes you think it should be 10.13? At school, we all learned how to
> In a record we have a value of 10.125 which is displayed with currency =
> True as 10.12 instead of 10.13 for classical windows app (excel, access).
"round" - however, always rounding .5 up doesn't distribute the "left
overs" in
the right way.
Delphi uses "bankers rounding" - always round to the nearest even integer.
Hence, .125 will end up .12 while .135 will end up .14 - this is a way of
rounding that (more) evenly distributes the left over values.
Martijn Tonies
InterBase Workbench - the developer tool for InterBase and Firebird
http://www.interbaseworkbench.com
Upscene Productions
http://www.upscene.com
"This is an object-oriented system.
If we change anything, the users object."