From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Philip Warner <pjw(at)rhyme(dot)com(dot)au> |
Cc: | Don Baccus <dhogaza(at)pacifier(dot)com>, Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu>, Romanenko Mikhail <mikhail(at)angg(dot)ru>, pgsql-general(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: [HACKERS] Re: Trouble with float4 afterupgrading from 6.5.3 to 7.0.2 |
Date: | 2000-08-08 14:04:44 |
Message-ID: | 19770.965743484@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-hackers |
Philip Warner <pjw(at)rhyme(dot)com(dot)au> writes:
> Given this, I have assumed that printf etc use these least significant bits
> to determine the 'correct' representation.
No. What float4-to-text really does is *discard* information, by
rounding off the printed result to only 7 digits (when there are
actually 7-and-change in there). This means values that are actually
distinct float4 values may get printed as the same thing:
regression=# select 1.234567 :: float4;
?column?
----------
1.23457
(1 row)
regression=# select 1.234568 :: float4;
?column?
----------
1.23457
(1 row)
regression=# select 1.234567 :: float4 = 1.234568 :: float4;
?column?
----------
f
(1 row)
regression=# select 1.234567 :: float4 - 1.234568 :: float4;
?column?
--------------
-9.53674e-07
(1 row)
I don't much care for this behavior (since it means dump and reload of
float columns is lossy), and I certainly won't hold still for
introducing it into other operations on floats.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | The Hermit Hacker | 2000-08-08 14:14:07 | Re: Release date for 7.1? |
Previous Message | Philip Warner | 2000-08-08 13:53:18 | Re: [HACKERS] Re: Trouble with float4 afterupgrading from 6.5.3 to 7.0.2 |
From | Date | Subject | |
---|---|---|---|
Next Message | Mike Mascari | 2000-08-08 14:17:23 | Re: Query plan and sub-queries |
Previous Message | Philip Warner | 2000-08-08 13:53:18 | Re: [HACKERS] Re: Trouble with float4 afterupgrading from 6.5.3 to 7.0.2 |