PSA: Postgres has extra_float_digits
Patrick Dowler
pdowler.cadc at gmail.com
Thu Jan 14 19:32:27 CET 2021
Markus,
Interesting... I do expect bit-exact-ness and in CAOM the metadata
checksums that are used would detect if there was a bit of lossiness.
However, CAOM only uses double precision for floating point numbers... Is
this specific to single precision aka real aka float?
At some point in the past I had a piece of test code to round trip all
manner of IEEE float and double values through databases to check for
support of edge cases and special values. Some RDBMS did worse than
others...
--
Patrick Dowler
Canadian Astronomy Data Centre
Victoria, BC, Canada
On Thu, 10 Dec 2020 at 01:28, Markus Demleitner <
msdemlei at ari.uni-heidelberg.de> wrote:
> Dear DAL implementors,
>
> While this may be common knowledge given there is a fairly prominent
> warning in the Postgres docs, I have to admit it's eluded me up to
> now:
>
> Postgres by default swallows least significant bits in the
> mantissas of floats over its normal wire protocol.
>
> This has recently been a bit of an embarrassment to me
> (https://blog.g-vo.org/the-case-of-the-disappearing-bits/), and so I
> thought it might be a good idea to send a heads-up to others who are
> writing code serving science data through postgres. The TL;DR is:
>
> If you want to serve out bit-exact floats from your Postgres, make
> sure it runs with extra_float_digits=3 set in one way or another.
>
> -- Markus
>
> (who'd be curious if other RDMSes have similar practices; sqlite, for
> one, doesn't seem to according to a quick experiment I've just run).
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.ivoa.net/pipermail/dal/attachments/20210114/862c23cb/attachment.html>
More information about the dal
mailing list