> Yes, as does virtually every other SQL-based system. Elevating the
> abstraction layer from platform-specific binary data to plain old text
> is one of the reasons SQL has taken over the world. There have been
> efforts to define cross-platform binary data formats (XDR and ASN.1 come
> to mind) but they remain relatively obscure.
The file format and the API I'm using to read it (FITS) supports IEEE 754, and, as far as
I know, so does C++ and MySQL (with the exception of NaN values). I just (perhaps
naively) want to take those numbers from the file and store them in the database without
parsing them as strings.
> Well, yes, but MySQL++ sets the precision to the largest value that
> preserves all the digits. With a 64-bit float ("double"), that's 17
> digits. If you're really running into roundoff or precision issues by
> losing something down in the 17th digit, you either shouldn't be using
> floating point in the first place, or you're using the wrong scale for
> your numbers.
> This really isn't a MySQL++ issue. It's an FP issue.
I've tested the precision, and MySQL++ doesn't set it automatically. I had to force it
using setprecision. I commented out any code that uses ostream just to make sure it
wasn't being set elsewhere.
>> It's critical
>> for my work that the original data is not massaged in any way.
> When you use FP, you lose precision at the lowest digits all the time.
> The question is whether it actually matters. You can say you need
> absolute fidelity, but you also say you're dealing with scientific data;
> I'd bet your data source doesn't actually give you 17 reliable digits of
> precision. A I've heard of some experiments having precision down in
> the part-per-trillion range, 5 orders of magnitude bigger than the loss
> of data at the last digit in a 64-bit float.
> If I'm wrong, please, I'd love to hear what instrument you're using that
> gives you 17 accurate digits in its measurements. Sounds awesome.
Fair enough. I can set the precision to a large value, but as stated above, I hoped I
could just copy the binary values from one container to another. However inaccurate the
measurements, at least I could say with confidence that the process of data ingestion has
not further altered the data.
View your Twitter and Flickr updates from one place – Learn more!