From: | Hiroshi Inoue <Inoue(at)tpf(dot)co(dot)jp> |
---|---|
To: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | floating point representation |
Date: | 2001-02-16 07:56:43 |
Message-ID: | 3A8CDD3B.3FFC57C8@tpf.co.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Robert.Farrugia | 2001-02-16 08:00:49 | Re: Kernel panic error |
Previous Message | Ryan Kirkpatrick | 2001-02-16 04:53:52 | Re: Re: Recovery of PGSQL after system crash failing!!! |