| From: | Francisco Olarte <folarte(at)peoplecall(dot)com> |
|---|---|
| To: | Charles <cooper(dot)charles(dot)m(at)gmail(dot)com> |
| Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org> |
| Subject: | Re: BUG #14138: Inconsistent rounding behavior in float4 coercion |
| Date: | 2016-05-23 16:44:19 |
| Message-ID: | CA+bJJbzKreSiNd7tKUXRMHGNBYb380qPNAvYRaGtya0wUQHDBg@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
Charles..
On Sun, May 22, 2016 at 9:18 PM, Charles <cooper(dot)charles(dot)m(at)gmail(dot)com> wrote:
> As a follow-up question, I am a bit confused as to the following behavior:
>
> elsendb=> set extra_float_digits = 3;
...
> elsendb=> select 11143.15 :: float4 :: text :: float4;
...
> 11143.1504
> elsendb=> select 11143.15 :: float4 :: numeric :: float4;
...
> 11143.2002
> How come 11143.1504 is not printed in all of these cases?
Probably because extra_f_d only plays when converting to/from text,
and not to numeric. It really is a mechanism to insure that text dumps
+ restores do not modify data. The other way is to use hex or binary
floating ( %a in printf ) in dumps, which, IIRC, postgres did
understand on input but had no way to generate on output.
If you insist on mixing finite precisison binary fractions ( float )
with decimal fractions ( numeric and/or text ) you should be prepared
for this. Do not do it or use a text intermediate step always so you
can control it.
Francico Olarte.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2016-05-23 17:00:08 | Re: BUG #14138: Inconsistent rounding behavior in float4 coercion |
| Previous Message | David G. Johnston | 2016-05-23 15:31:17 | Re: BUG #14154: In pgpool while using delete query inside postgresql function , it is not deletingdata from all serve |