From: | Maciek Sakrejda <m(dot)sakrejda(at)gmail(dot)com> |
---|---|
To: | Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at> |
Cc: | "Tom Duffey *EXTERN*" <tduffey(at)trillitech(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: [GENERAL] Floating point error |
Date: | 2013-03-04 04:34:31 |
Message-ID: | CAOtHd0AybkCsA7CA+MyHKWwA0vFKV9euk4GObWmvYce55+=Qiw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-hackers |
While having more docs around extra_float_digits is a great idea, I
don't think the patch really clarifies much.
(Disclaimer: I honestly have only a vague idea of the reasoning behind
extra_float_digits existing in the first place, but perhaps that means
I'm a good target audience for the doc patch. Also, I apologize if
anything below sounds abrasive--having worked on both my own driver
and a few things here and there on the JDBC one, plus running into
this in assorted places in the wild, I still find extra_float_digits
baffling at best. I immensely appreciate the effort to make
improvements here.)
That is, the patch explains some of the reasoning behind the setting,
but it doesn't really help the reader identify where setting this is
useful and/or necessary. E.g., the JDBC driver just indiscriminately
sets extra_float_digits to 3 if the server supports it (the max
allowable). Is this a bogus approach?
+ The (inherently inaccurate) textual representation of a <type>real</type>
+ or <type>double precision</type> value...
Isn't full fidelity possible assuming sensible rounding semantics and
enough characters of precision? Isn't that the point of
extra_float_digits?
+ will by default contain only as many
+ significant digits as can be represented without losing precision
+ on any platform supported by PostgreSQL.
How would providing more digits lose precision? Platform as in a
non-IEEE 754 server restoring a dump? A non-IEEE 754 client running
queries? Something more subtle? And how does having more precision in
the serialized cause these to lose precision when decoding the value?
I think extra_float_digits is an awkward, surprising implementation
detail--at first glance it seems like a "flip this switch for correct
behavior" knob. I'd love to have a clear explanation in the docs of
why it's needed, and when you should and should not set it (e.g., is
the JDBC driver wrong to set it all the time? should every driver set
it all the time?).
Thanks,
Maciek
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2013-03-04 05:14:54 | Re: [HACKERS] Floating point error |
Previous Message | Ian Harding | 2013-03-04 04:27:32 | Fwd: pg_upgrade |
From | Date | Subject | |
---|---|---|---|
Next Message | Amit Kapila | 2013-03-04 04:39:57 | Re: Performance Improvement by reducing WAL for Update Operation |
Previous Message | Craig Ringer | 2013-03-04 04:23:13 | Re: Enabling Checksums |