Re: Re: [GENERAL] Trouble with float4 after upgrading from 6.5.3 to 7.0.2
От | Don Baccus |
---|---|
Тема | Re: Re: [GENERAL] Trouble with float4 after upgrading from 6.5.3 to 7.0.2 |
Дата | |
Msg-id | 3.0.1.32.20000807112950.0140fae0@mail.pacifier.com обсуждение исходный текст |
Ответ на | Re: Re: [GENERAL] Trouble with float4 after upgrading from 6.5.3 to 7.0.2 (Philip Warner <pjw@rhyme.com.au>) |
Список | 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@pacifier.com> Nature photos, on-line guides, Pacific Northwest Rare Bird Alert Serviceand other goodies at http://donb.photo.net.
В списке pgsql-hackers по дате отправления: