pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Sullivan <andrew@libertyrms.info>
To: pgsql-admin@postgresql.org
Subject: Re: Precision when substracting two values with SQL
Date: Mon, 12 Aug 2002 16:27:42 -0400
Message-ID: <20020812162742.Z17166@mail.libertyrms.com> (raw)
In-Reply-To: <3D58132C.6040303@maxiconsumo.com>
References: <3D58132C.6040303@maxiconsumo.com>

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@libertyrms.info>                              M6K 3E3
                                         +1 416 646 3304 x110




view thread (6+ messages)  latest in thread

Message-ID: <20020812162742.Z17166@mail.libertyrms.com>
Permalink:  ../20020812162742.Z17166@mail.libertyrms.com/
Also on:    postgresql.org/message-id/20020812162742.Z17166@mail.libertyrms.com

 · 

reply

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: andrew@libertyrms.info
  Subject: Re: Precision when substracting two values with SQL
  In-Reply-To: <20020812162742.Z17166@mail.libertyrms.com>
  References: <3D58132C.6040303@maxiconsumo.com> <20020812162742.Z17166@mail.libertyrms.com>

* 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