From: | Don Baccus <dhogaza(at)pacifier(dot)com> |
---|---|
To: | Philip Warner <pjw(at)rhyme(dot)com(dot)au>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | "Romanenko Mikhail" <mikhail(at)angg(dot)ru>, pgsql-general(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Re: [GENERAL] Trouble with float4 after upgrading from 6.5.3 to 7.0.2 |
Date: | 2000-08-07 18:29:50 |
Message-ID: | 3.0.1.32.20000807112950.0140fae0@mail.pacifier.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-hackers |
At 02:15 AM 8/8/00 +1000, Philip Warner wrote:
>I wasn't complaining about the float4 accuracy; I was complaining about the
>way it was converted to float8. It seems more intuitive to zero-extend base
>10 zeros...
You're right, it absolutely is more intuitive - in a base-10 representation,
i.e. NUMERIC. A float4 is a binary number, and the only zeros available
are binary ones. The same is true of the non-zeros, for that matter. Not
that it matters, adding zero to the right of any number doesn't add
significance,
something they pound into people's heads in the physical sciences.
Doing a type conversion from float4 to float8 is in general not a safe thing
to do, because you only can depend on 24 bits of mantissa significance
afterwards anyway. One such conversion will propagate that lesser
significance
all throughout the expressions using it. Take great care when you do this.
As Tom pointed out you're getting 8 digits of decimal significance in
your example (10.100000) due to the particular number involved. You can
only expect 24/log2(10) digits, which as he points out is just 7 digits plus
change.
The basic problem is that we evolved with 10 fingers, rather than 8 or 16 :)
- Don Baccus, Portland OR <dhogaza(at)pacifier(dot)com>
Nature photos, on-line guides, Pacific Northwest
Rare Bird Alert Service and other goodies at
http://donb.photo.net.
From | Date | Subject | |
---|---|---|---|
Next Message | Stephan Szabo | 2000-08-07 18:38:51 | Re: foreign keys |
Previous Message | Tom Lane | 2000-08-07 16:53:50 | Re: [HACKERS] Re: Trouble with float4 afterupgrading from 6.5.3 to 7.0.2 |
From | Date | Subject | |
---|---|---|---|
Next Message | Don Baccus | 2000-08-07 18:33:18 | Re: Constraint stuff |
Previous Message | Stephan Szabo | 2000-08-07 18:13:08 | Re: Constraint stuff |