Re: Significant Digits in Floating Point Datatype

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Significant Digits in Floating Point Datatype
Дата
Msg-id 2883.1321815987@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Significant Digits in Floating Point Datatype  (Lee Hachadoorian <lee.hachadoorian@gmail.com>)
Ответы Re: Significant Digits in Floating Point Datatype  (Lee Hachadoorian <lee.hachadoorian@gmail.com>)
Список pgsql-general
Lee Hachadoorian <lee.hachadoorian@gmail.com> writes:
> And can I reliably retrieve the original integer by
> casting to int (or bigint) if the number of digits in the original
> integer is less than 15?

On IEEE-floating-point machines, I'd expect float8 to store integers
up to 2^52 (or maybe it's 2^53) exactly.  With other floating-point
formats the limit might be different, but it should still be exact for
reasonable-size integers.  This has nothing whatever to do with whether
decimal fractions are reproduced exactly (in general, they aren't, no
matter how many or few digits are involved).  So integers are fine,
bigints not so much.

            regards, tom lane

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

Предыдущее
От: Scott Marlowe
Дата:
Сообщение: Re: Installed. Now what?
Следующее
От: Cédric Villemain
Дата:
Сообщение: Re: How to install pgfincore with PG 9.1