float conversion / presentation problem ?

Поиск
Список
Период
Сортировка
От Enrico Weigelt
Тема float conversion / presentation problem ?
Дата
Msg-id 20050407012915.GA18482@nibiru.borg.metux.de
обсуждение исходный текст
Ответы Re: float conversion / presentation problem ?  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: float conversion / presentation problem ?  (Neil Conway <neilc@samurai.com>)
Список pgsql-bugs
Hi folks,


i've noticed an problem with conversion from real to float -
this produces ugly values. (in fact it seems to be real->float8)

> fxignal=# SELECT 12.345::real::float;
>       float8
> ------------------
>  12.3450002670288

Maybe its not really an conversion problem, but an bug in sprintf(),
(there were some other float related bugs known in glibc), as these
examples let me suspect:

> fxignal=# SELECT 12.345::real::float::real;
>  float4
> --------
>  12.345

> fxignal=# SELECT ((12.345::real::float8)-(0.345::float8))::real;
>  float4
> --------
>      12

I noticed this behaviour on postgresql-7.4.1 and 7.4.3 on glibc-2.3.2


BTW: real is an alias to float4 ?

regards,
--
---------------------------------------------------------------------
 Enrico Weigelt    ==   metux IT service

  phone:     +49 36207 519931         www:       http://www.metux.de/
  fax:       +49 36207 519932         email:     contact@metux.de
  cellphone: +49 174 7066481
---------------------------------------------------------------------
 -- DSL ab 0 Euro. -- statische IP -- UUCP -- Hosting -- Webshops --
---------------------------------------------------------------------

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

Предыдущее
От: "Jean-Pierre Pelletier"
Дата:
Сообщение: BUG #1585: could not read from statistics collector pipe
Следующее
От: Tom Lane
Дата:
Сообщение: Re: float conversion / presentation problem ?