Re: Formatting query output

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: Formatting query output
Дата
Msg-id 20021029005014.GE29873@svana.org
обсуждение исходный текст
Ответ на Formatting query output  (Pedro Miguel Frazao Fernandes Ferreira <pfrazao@ualg.pt>)
Список pgsql-general
On Mon, Oct 28, 2002 at 02:56:20PM +0000, Pedro Miguel Frazao Fernandes Ferreira wrote:
> Hi All,
>
> I am using libpq to interface PostgreSQL with Matlab.
> My question is about formatting query results:
>
> If I have a table field which is of type float8 and I insert, for
> example, a value of 4503599627370496, when I do a select on this table
> field I get 4.5035996273705e+15.

I think the reason for that is that float8s can only store about 16
significant digits anyway so you're cutting pretty close to the line.
Remember, floating point numbers are accurate but not precise. Do you really
need that extra digit of precision?

Maybe you should be using numeric() type for this. Actually, it looks like a
credit card number, perhaps you should use a string if you're not actually
doing calculations on it.

--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> There are 10 kinds of people in the world, those that can do binary
> arithmetic and those that can't.

Вложения

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

Предыдущее
От: Lee Harr
Дата:
Сообщение: Re: newbie question for return date
Следующее
От: Medi Montaseri
Дата:
Сообщение: Re: newbie question for return date