float conversion / presentation problem ? - Mailing list pgsql-bugs

From Enrico Weigelt
Subject float conversion / presentation problem ?
Date
Msg-id 20050407012915.GA18482@nibiru.borg.metux.de
Whole thread Raw
Responses Re: float conversion / presentation problem ?
Re: float conversion / presentation problem ?
List 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 by date:

Previous
From: "Jean-Pierre Pelletier"
Date:
Subject: BUG #1585: could not read from statistics collector pipe
Next
From: Tom Lane
Date:
Subject: Re: float conversion / presentation problem ?