Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 309B29FB781 for ; Tue, 17 Apr 2007 17:28:10 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 48413-07-2 for ; Tue, 17 Apr 2007 17:28:03 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from rootabega.88thstreet.com (dsl254-071-237.nyc1.dsl.speakeasy.net [216.254.71.237]) by postgresql.org (Postfix) with ESMTP id 38E229FB70C for ; Tue, 17 Apr 2007 17:28:06 -0300 (ADT) Received: from www.88thstreet.com (localhost [IPv6:::1]) by rootabega.88thstreet.com (8.13.3/8.13.3) with ESMTP id l3HKS4l8005288; Tue, 17 Apr 2007 16:28:04 -0400 (EDT) Received: from 63.118.86.10 (SquirrelMail authenticated user radhika) by www.88thstreet.com with HTTP; Tue, 17 Apr 2007 16:28:04 -0400 (EDT) Message-ID: <19167.63.118.86.10.1176841684.squirrel@www.88thstreet.com> In-Reply-To: <504276.57905.qm@web31804.mail.mud.yahoo.com> References: <4838.63.118.86.10.1176836034.squirrel@www.88thstreet.com> <504276.57905.qm@web31804.mail.mud.yahoo.com> Date: Tue, 17 Apr 2007 16:28:04 -0400 (EDT) Subject: Re: Floating point type to store numbers From: "Radhika Sambamurti" To: "Richard Broersma Jr" Cc: pgsql-sql@postgresql.org Reply-To: radhika@88thstreet.com User-Agent: SquirrelMail/1.4.5 MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200704/154 X-Sequence-Number: 28154 > > --- >> The question is: how accurate is floating point numbers in Postgres. We >> are using 7.4 soon to be moving to 8.2. >> I need the accuracy to about 6 decimal points. I have read that floating >> points can convert to numbers in accurately. > > http://www.postgresql.org/docs/8.2/interactive/datatype-numeric.html#DATATYPE-FLOAT > > I didn't see anything about numeric being a string type, > > Numeric values are physically stored without any extra leading or trailing zeroes. Thus, the declared precision and scale of a column are maximums, not fixed allocations. (In this sense the numeric type is more akin to varchar(n) than to char(n).) The actual storage requirement is two bytes for each group of four decimal digits, plus eight bytes overhead. However, arithmetic on numeric values is very slow compared to the integer types, or to the floating-point types described in the next section. http://www.postgresql.org/docs/8.2/static/datatype-numeric.html http://www.postgresql.org/docs/8.2/interactive/datatype-numeric.html#DATATYPE-NUMERIC-DECIMAL > > Regards, > Richard Broersma Jr. > -- It is all a matter of perspective. You choose your view by choosing where to stand. Larry Wall --- -- It is all a matter of perspective. You choose your view by choosing where to stand. Larry Wall ---