Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 59E9A476090 for ; Mon, 12 Aug 2002 16:52:22 -0400 (EDT) Received: from beamish.nsd.ca (unknown [205.150.156.194]) by postgresql.org (Postfix) with ESMTP id 2DB04476334 for ; Mon, 12 Aug 2002 16:51:04 -0400 (EDT) Received: (from smap@localhost) by beamish.nsd.ca (8.9.3/8.9.3) id QAA26726; Mon, 12 Aug 2002 16:51:04 -0400 X-Authentication-Warning: beamish.nsd.ca: smap set sender to using -f Received: from reddog.nsd.ca(192.168.101.30) by beamish.nsd.ca via smap (V2.1/2.1+anti-relay+anti-spam) id xma026724; Mon, 12 Aug 02 16:50:52 -0400 Received: from nsd.ca ([192.168.101.148]) by reddog.nsd.ca (8.8.7/8.8.7) with ESMTP id QAA11179; Mon, 12 Aug 2002 16:50:52 -0400 Message-ID: <3D581FDE.B04D7B83@nsd.ca> Date: Mon, 12 Aug 2002 16:51:42 -0400 From: Jean-Luc Lachance X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.4.9-31 i686) X-Accept-Language: en MIME-Version: 1.0 To: Andrew Sullivan Cc: pgsql-admin@postgresql.org Subject: Re: Precision when substracting two values with SQL References: <3D58132C.6040303@maxiconsumo.com> <20020812162742.Z17166@mail.libertyrms.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200208/125 X-Sequence-Number: 5240 I think you meant: select 0.2:: numeric(12,2) - 0.21::numeric(12,2); If you are not conviced try: select (0.2-0.21)::numeric(40,20); Andrew Sullivan wrote: > > 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 > M6K 3E3 > +1 416 646 3304 x110 > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org