Subject Re: [ib-support] Wierd math???
Author Markus Ostenried
At 13:07 Thursday, 20.02.2003 -0800, you wrote:

> >It should, but since you are using floating point numbers your numbers
> >do not have "exactly" 2 decimal places. Actually, their decimal point
> >floats. Search the archives for thorough discussions about this
> >problem.
>
>I do understand the issues with floating point numbers. It's just that if
>the SOURCE numbers all come out with 2 decimal places, I would expect their
>SUM to also. I would just expect the database to add them together the
>same way I would (line up the decemal points and add). It just seems like
>a simple thing for it to do to get a "precise" sum from "precise" source
>numbers.
>
>I mean, the source numbers at least come out precisely in the output. i.e.
>Why does 7.34 output as 7.34, and not 7.340000000000000021, but the sum has
>that problem?
>
>-Joe

Joe,

what firebird/interbase version and what client tool/component set are you
using ?
what is the data type of your txamount column ?
what happens if you explicitly cast your SUM statement ?

select CAST(sum(txamount) AS Decimal(9,2)) from laytransactions where layid = 5

regards,
Markus