Re: Precision when substracting two values with SQL - Mailing list pgsql-admin

From Larry Rosenman
Subject Re: Precision when substracting two values with SQL
Date
Msg-id 1029184021.473.35.camel@lerlaptop.iadfw.net
Whole thread Raw
In response to Re: Precision when substracting two values with SQL  (Tim Ellis <Tim.Ellis@gamet.com>)
List pgsql-admin
On Mon, 2002-08-12 at 15:24, Tim Ellis wrote:
> > ciudadela=# select 0.2-0.2;
> >         0
> > ciudadela=# select 0.2-0.21;
> >  -0.00999999999999998
> > ciudadela=# select 0.21-0.22;
> >     -0.01
>
> I also get this on my Postgres 7.2.1, both Linux and Solaris.
You are comparing floats.

This is a STANDARD problem with Base 10 Floating point.

LER

--
Larry Rosenman                     http://www.lerctr.org/~ler
Phone: +1 972-414-9812                 E-Mail: ler@lerctr.org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749


pgsql-admin by date:

Previous
From: Tim Ellis
Date:
Subject: Re: Precision when substracting two values with SQL
Next
From: Andrew Sullivan
Date:
Subject: Re: Precision when substracting two values with SQL