Re: Formatting query output

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Formatting query output
Дата
Msg-id 24314.1035931296@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Formatting query output  (Pedro Miguel Frazao Fernandes Ferreira <pfrazao@ualg.pt>)
Список pgsql-general
Pedro Miguel Frazao Fernandes Ferreira <pfrazao@ualg.pt> writes:
> When I store a float8
> number in a database, I am supposed to fetch the number as inserted.

I fear you have a fundamental misconception about the nature of
floating-point representation.  There is no such thing as "fetching the
number as inserted".  You get only as much accuracy as float8 format
will store, which is about half a digit less than you are asking for in
this case.

The fact that you might be able to store this particular 16-digit value
exactly is no guarantee that you'll be able to store other 16-digit
values exactly, so I recommend choosing another representation if
that's your requirement.  Blaming the output formatting is the wrong
way to look at it.

            regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: User functions not displayed by \df
Следующее
От: Robert Treat
Дата:
Сообщение: Re: PHP and PostgreSQL