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

From John R Pierce
Subject Re: float conversion / presentation problem ?
Date
Msg-id 4254B9BA.60008@hogranch.com
Whole thread Raw
In response to Re: float conversion / presentation problem ?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: float conversion / presentation problem ?
List 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 by date:

Previous
From: Tom Lane
Date:
Subject: Re: float conversion / presentation problem ?
Next
From: Tom Lane
Date:
Subject: Re: float conversion / presentation problem ?