Re: Floating point type to store numbers

From: "Radhika Sambamurti" <radhika(at)88thstreet(dot)com>
To: "Richard Broersma Jr" <rabroersma(at)yahoo(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Floating point type to store numbers
Date: 2007-04-17 20:28:04
Message-ID: 19167.63.118.86.10.1176841684.squirrel@www.88thstreet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Radhika Sambamurti 2007-04-17 20:33:33 Re: Floating point type to store numbers
Previous Message Richard Broersma Jr 2007-04-17 19:18:16 Re: Floating point type to store numbers