<div dir="ltr"><div class="gmail_default" style="font-size:small">Markus,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">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? </div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">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...</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><br clear="all"></div><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div>--<br></div><div>Patrick Dowler<br></div>Canadian Astronomy Data Centre<br></div>Victoria, BC, Canada<br></div></div></div></div></div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, 10 Dec 2020 at 01:28, Markus Demleitner <<a href="mailto:msdemlei@ari.uni-heidelberg.de">msdemlei@ari.uni-heidelberg.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Dear DAL implementors,<br>
<br>
While this may be common knowledge given there is a fairly prominent<br>
warning in the Postgres docs, I have to admit it's eluded me up to<br>
now:<br>
<br>
Postgres by default swallows least significant bits in the<br>
mantissas of floats over its normal wire protocol.<br>
<br>
This has recently been a bit of an embarrassment to me<br>
(<a href="https://blog.g-vo.org/the-case-of-the-disappearing-bits/" rel="noreferrer" target="_blank">https://blog.g-vo.org/the-case-of-the-disappearing-bits/</a>), and so I<br>
thought it might be a good idea to send a heads-up to others who are<br>
writing code serving science data through postgres. The TL;DR is:<br>
<br>
If you want to serve out bit-exact floats from your Postgres, make<br>
sure it runs with extra_float_digits=3 set in one way or another.<br>
<br>
-- Markus<br>
<br>
(who'd be curious if other RDMSes have similar practices; sqlite, for<br>
one, doesn't seem to according to a quick experiment I've just run).<br>
</blockquote></div>