> Hmm.. looks like you're running into the 80x87 IEEE rounding model, which
> isn't helped by the fact the the Delphi supplied SysUtils.pas and Maths.pas
> rounding routines are rather weak.
> How have you declared Total? As a Extended, a Float, or a Currency?


> Changing it to Currency if it isn't already may ensure Delphi generates
> better 80x87 assembler code with less IEEE rounding artifacts. A faint hope
> but worth a shot.
> Alternatively, you should be rounding the final result to the correct number
> of decimal places (in this case 2) which will give you the desired answer
> (that's what we do).

Except that, when retreived, the value is 10.1399 not 10.14, and when
that .0001 if appilied over a few thousand records, its out by a cent or

It just seams odd that the BDE can sum it up fine in SQL, but fails
badly to return it to Delphi.

Actually, its not that odd. Its the BDE :)

> Ideally, you will want a rounding routine which returns an Extended (unlike
> Delphi's Round which returns either a Longint or an Int64) and preferably
> does financial rounding rather than engineering rounding (i.e. Round(x)
> = -Round(-x)) in case you are ever summing credits.

Yup, it may be rounding credits also, so looks like new rounding
routines will have to be written :)


    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to