Re: strange sum behaviour - Mailing list pgsql-general

From Peter Eisentraut
Subject Re: strange sum behaviour
Date
Msg-id 200608291957.56015.peter_e@gmx.net
Whole thread Raw
In response to strange sum behaviour  ("Andrew Baerg" <andrew.baerg@gmail.com>)
List pgsql-general
> 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/

pgsql-general by date:

Previous
From: "codeWarrior"
Date:
Subject: Re: strange sum behaviour
Next
From: Seneca Cunningham
Date:
Subject: Re: strange sum behaviour