On 28 Jan 2015, at 10:47pm, Donald Shepherd <donald.sheph...@gmail.com> wrote:

> This is a bit of a speculative question related to a problem I'm having -
> are there legal values of a C++ double that would get truncated when
> written into and read from an SQLite database?

In theory there should be no problem here.

C doubles have 15 to 16 digits of precision.

In SQLite databases, numbers which can't be stored as integers are stored as 
IEEE 754-2008 64-bit floating point numbers, sometimes known as 'binary64'.  
These give 15 to 17 digits of precision.

My understanding is that it is possible to store every distinct C double value 
as a distinct binary64 value.

If it's the conversion that worries you, you can read the SQLite source code to 
find the programming used to encode and decode numbers into this format.  I am 
not competent to read that source code and tell you definitely that it works 
for all C double values.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to