On 31 Jul 2019, at 10:15pm, Eric Reischer <e...@hev.psu.edu> wrote: > Is there a way to pass binary representations of floating point numbers to a > SQL query? If sqlite's internal representation of floating point numbers is > 8-byte IEEE doubles, it would be convenient to be able to pass the literal > value of a float or double to the underlying SQL parser without suffering the > quantization that occurs with printf()'ing floating point values.
Rather than including the values in the text of the query: INSERT INTO A (B) VALUES (3.1) use a parameter marker: INSERT INTO A (B) VALUES (?) and bind the value to that parameter: <https://sqlite.org/c3ref/bind_blob.html> int sqlite3_bind_double(sqlite3_stmt*, int, double); This does not involve any rendering of the value into a string. However, since the C double is not necessarily a representation of IEEE value, you cannot rely on values being passed entirely unchanged. _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users