Hi!

On Wed, 24 Apr 2002 04:33:00 -0400 (EDT)
[EMAIL PROTECTED] wrote:

> Francisco Blay ([EMAIL PROTECTED]) reports a bug with a severity of 3
> The lower the number the more severe it is.
> 
> Short Description
> Incorrect result in math operation
> 
> Long Description
> 3088.8 - (2847.64 + 241.16)=4.54747350886464e-13
> It's spected to be 0.0 the result of this operation (I think)
> Got the same results in
> 
...
> datadb=# select 3088.8 - (2847.64 + 241.16) AS silly;
>         silly
> ----------------------
>  4.54747350886464e-13
> (1 row)
> 

I think it's a limitation of floating point numbers representation, not a PostgreSQL 
bug. Use NUMERIC type, if you need an "exact" precision:

org=> SELECT 3088.8::numeric(8,3) - (2847.64::numeric(8,3) + 241.16::numeric(8,3)) AS 
silly;
 silly 
-------
 0.000
(1 row)
 
Best regards

-- 
Dmitry Tsitelov
mailto:[EMAIL PROTECTED]


---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly

Reply via email to