Hi all,
I have a question of PostgreSQL's floating point
representation.
create table t (fl1 float4, fl2 float4, fl3 float4);
insert into t values (1.234567, 1.23457, 1.23457);
select * from t;
fl1 | fl2 | fl3
---------+---------+---------
1.23457 | 1.23457 | 1.23457
(1 row)
select * from t where fl1=fl2;
fl1 | fl2 | fl3
-----+-----+-----
(0 rows)
select * from t where t where fl2=fl3;
fl1 | fl2 | fl3
---------+---------+---------
1.23457 | 1.23457 | 1.23457
(1 row)
OK, fl1 != fl2 and fl2 == fl3 but
copy t to stdout;
1.23457 1.23457 1.23457
The output of pg_dump is same. Then
after restoring from the pg_dump
output, we would get a tuple such
that fl1==fl2==fl3.
Is it reasonable ?
In addtion this makes a client library like ODBC
driver very unhappy with the handlig of floating
point data. For example, once a floating point
data like fl1(1.234567) was stored, MS-Access
couldn't update the tuple any more.
Is there a way to change the precision of floating
point representation from clients ?
Regards,
Hiroshi Inoue
- Re: [HACKERS] floating point representation Hiroshi Inoue
- Re: [HACKERS] floating point representation Peter Eisentraut
- Re: [HACKERS] floating point representation Tom Lane
- RE: [HACKERS] floating point representation Hiroshi Inoue
- Re: [HACKERS] floating point representat... Hiroshi Inoue
- Re: [HACKERS] floating point repres... Tom Lane
- Re: [HACKERS] floating point re... Hiroshi Inoue
- Re: [HACKERS] floating poin... Tom Lane
- [HACKERS] Re: floating poin... Thomas Lockhart
- Re: [HACKERS] floating poin... Pete Forman
- Re: [HACKERS] floating poin... Tom Lane