Re: Floating point type to store numbers

Поиск
Список
Период
Сортировка
От Milen A. Radev
Тема Re: Floating point type to store numbers
Дата
Msg-id f03636$bat$1@sea.gmane.org
обсуждение исходный текст
Ответ на Floating point type to store numbers  ("Radhika Sambamurti" <radhika@88thstreet.com>)
Ответы Re: Floating point type to store numbers
Список pgsql-sql
Radhika Sambamurti написа:
> Hi,
> I am currently using Postgresql to maintain an application which is used
> for trading and back office operations. Currently our monetary fields are
> stored in Varchar. I am finding a huge CPU utilization while converting
> from varchar to float. I think for reasons unknown to me, we originally
> stored $ amounts and rates in varchar. I am planning to convert our tables
> that hold money fields and rates from varchar to float. I do not want to
> convert to numeric because numeric is a special string type.
> 
> 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.


I believe the manual is quite clear on that one (
http://www.postgresql.org/docs/current/static/datatype-numeric.html#DATATYPE-FLOAT)
:

" - If you require exact storage and calculations (such as for monetary
amounts), use the numeric type instead."


So if you decide to use floats after this warning you are on your own.


-- 
Milen A. Radev



В списке pgsql-sql по дате отправления:

Предыдущее
От: Andrew Sullivan
Дата:
Сообщение: Re: Floating point type to store numbers
Следующее
От: Richard Broersma Jr
Дата:
Сообщение: Re: Floating point type to store numbers