From: Larry Rosenman <ler@lerctr.org>
To: Tim Ellis <Tim.Ellis@gamet.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: Precision when substracting two values with SQL
Date: 12 Aug 2002 15:27:01 -0500
Message-ID: <1029184021.473.35.camel@lerlaptop.iadfw.net> (raw)
In-Reply-To: <20020812132407.41c1b314.Tim.Ellis@gamet.com>
References: <3D58132C.6040303@maxiconsumo.com>
<20020812132407.41c1b314.Tim.Ellis@gamet.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: ler@lerctr.org, Tim.Ellis@gamet.com
Subject: Re: Precision when substracting two values with SQL
In-Reply-To: <1029184021.473.35.camel@lerlaptop.iadfw.net>
References: <3D58132C.6040303@maxiconsumo.com> <20020812132407.41c1b314.Tim.Ellis@gamet.com> <1029184021.473.35.camel@lerlaptop.iadfw.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox