Search Postgresql Archives

Re: strange sum behaviour

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> corp=# select sum(amount) from acc_trans where trans_id=19721 and
> chart_id=10019;
>          sum
> ----------------------
>  -1.4210854715202e-14

[expected to be 0]

Floating-point numbers are typically inaccurate like that, and if you 
rely in equality comparisons, you're doing something wrong.  You should 
use numeric or fix your application to take these errors into account.

-- 
Peter Eisentraut
http://developer.postgresql.org/~petere/


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux