Re: Floating point type to store numbers - Mailing list pgsql-sql

From Radhika Sambamurti
Subject Re: Floating point type to store numbers
Date
Msg-id 19167.63.118.86.10.1176841684.squirrel@www.88thstreet.com
Whole thread Raw
In response to Re: Floating point type to store numbers  (Richard Broersma Jr <rabroersma@yahoo.com>)
List 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
---



pgsql-sql by date:

Previous
From: Richard Broersma Jr
Date:
Subject: Re: Floating point type to store numbers
Next
From: "Radhika Sambamurti"
Date:
Subject: Re: Floating point type to store numbers