pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Radhika Sambamurti <radhika@88thstreet.com>
To: Richard Broersma Jr <rabroersma@yahoo.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Floating point type to store numbers
Date: Tue, 17 Apr 2007 16:28:04 -0400 (EDT)
Message-ID: <19167.63.118.86.10.1176841684.squirrel@www.88thstreet.com> (raw)
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>

>
> ---
>> 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
---




view thread (10+ messages)  latest in thread

Message-ID: <19167.63.118.86.10.1176841684.squirrel@www.88thstreet.com>
Permalink:  ../19167.63.118.86.10.1176841684.squirrel@www.88thstreet.com/
Also on:    postgresql.org/message-id/19167.63.118.86.10.1176841684.squirrel@www.88thstreet.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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: radhika@88thstreet.com, rabroersma@yahoo.com
  Subject: Re: Floating point type to store numbers
  In-Reply-To: <19167.63.118.86.10.1176841684.squirrel@www.88thstreet.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