Re: float conversion / presentation problem ?

Поиск
Список
Период
Сортировка
От John R Pierce
Тема Re: float conversion / presentation problem ?
Дата
Msg-id 4254B9BA.60008@hogranch.com
обсуждение исходный текст
Ответ на Re: float conversion / presentation problem ?  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: float conversion / presentation problem ?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
Tom Lane wrote:
> Enrico Weigelt <weigelt@metux.de> writes:
>
>>i've noticed an problem with conversion from real to float -
>>this produces ugly values. (in fact it seems to be real->float8)
>
>
> You do realize that float4/real is only good to six decimal places
> on most platforms?
>
> You can take the issue up with the glibc boys if you like, but
> I think you'll get laughed off.

and importantly, are stored as binary fractions.  0.10000 decimal is a
repeating fraction in binary, its like .1100110011.... x 2^-2 or something as a
FLOAT.   Float4 has like 22 bits of significants for the mantissa, while Float8
has like 51 bits or something (this is from rusty memory, so I could have
slipped a few bits here).

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: float conversion / presentation problem ?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: float conversion / presentation problem ?