Re: Precision when substracting two values with SQL

From: Andrew Sullivan <andrew(at)libertyrms(dot)info>
To: pgsql-admin(at)postgresql(dot)org
Subject: Re: Precision when substracting two values with SQL
Date: 2002-08-12 20:27:42
Message-ID: 20020812162742.Z17166@mail.libertyrms.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Mon, Aug 12, 2002 at 04:57:32PM -0300, Juancho wrote:
>
> ciudadela=# select 0.2-0.21;
> ?column?
> ----------------------
> -0.00999999999999998
> (1 row)
>
> I was hoping -0.01,

Try

select (0.2-0.21)::numeric(12,2);

A

--
----
Andrew Sullivan 87 Mowat Avenue
Liberty RMS Toronto, Ontario Canada
<andrew(at)libertyrms(dot)info> M6K 3E3
+1 416 646 3304 x110

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Juancho 2002-08-12 20:33:00 Re: Precision when substracting two values with SQL
Previous Message Larry Rosenman 2002-08-12 20:27:01 Re: Precision when substracting two values with SQL