I’d say the mistake here is converting a double to a string before inserting it 
into the database. Any time you convert between floating point and decimal (or 
vice versa) you can lose accuracy, and are not guaranteed round-trip fidelity.

(0.1, 0.01, 0.001, etc. do not have finite-length exact representations in 
binary, just like 1/7 doesn’t in decimal. So most non-integers that look 
reasonable in decimal are in fact subject to round-off errors in binary 
floating point.)

As I said earlier today about strings: don’t hardcode data values into SQL 
statements. Use bindings instead.

—Jens
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to