Subject Re: [firebird-support] why the result is the number commas?
Author Mark Rotteveel
On 2-6-2012 19:47, softdestek wrote:
> ACCOUNTS.DEBT is double
> ACCOUNTS.RECEIVABLES is double
>
> MY QUERY
> SELECT
> SUM(ACCOUNTS.DEBT),
> SUM(ACCOUNTS.RECEIVABLES),
> sum(ACCOUNTS.DEBT)-SUM(ACCOUNTS.RECEIVABLES)
> FROM ACCOUNTS
> WHERE ACCOUNTS.CODE='100'
>
>
>
> 1) SQL RESULT
> SUM(ACCOUNTS.DEBT) 2708021,63
> 2) SQL RESULT
> SUM(ACCOUNTS.RECEIVABLES) 2707357,52
> the correct result=664,11
>
> 3)SQL RESULT
> sum(ACCOUNTS.DEBT)-SUM(ACCOUNTS.RECEIVABLES) 664,109999998938
> Why is this?
> Why is there a difference between the two results?

Double precision is not exact due to the way it represents numbers, see
http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html for a
thorough explanation.

Mark

--
Mark Rotteveel