On 14 Jun 2012, at 9:30pm, Etienne <[email protected]> wrote: > js>var db = new SQLite(); > js>db.exec("select 99990.1", function(r){writeln(r)}); > 99990.1=99990.1000000001 > true
There's no way to store the fraction 0.1 as a binary value. Read this: <http://revjim.net/2003/05/07/funny-math/> or go read any beginner's book on computer science. SQLite, just like every other programming language, goes some way to fake its results but you can usually find some very simple operation which will make it expose the fact that it's all faked. This isn't a bug in SQLite, it's a problem with pretending you can do the same things with binary and decimal numbers. If you know you're going to need to store fractional values exactly, multiply all your numbers up until you can store integers. For instance, if you need to store integer amounts of money precisely, multiply all the values by 100, store cents instead of Euros, and store them as INTEGER rather than REAL/FLOAT. Simon. _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

