And didn't we go through this a while ago...

Sqlite3's precision is 14...sometimes 15....
sqlite> select round(22.35-(5.45+16.9),15);
4.0e-15
sqlite> select round(22.35-(5.45+16.9),14);
0.0

So this also works:
sqlite> select round(22.35 - (5.45 + 16.9),14), 22.35 = round((5.45 +
16.9),14), round((5.45 + 16.9) - 22.35,14);
0.0|1|0.0



-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Israel Lins
Albuquerque
Sent: Thursday, March 07, 2013 12:04 PM
To: [email protected]
Subject: [sqlite] Bug on real operations

An example speaks more than words:

Execute this:
SELECT 22.35 - (5.45 + 16.9), 22.35 = (5.45 + 16.9), (5.45 + 16.9) - 22.35;

The expected result on almost databases is:
0.0, true or 1, 0.0

But in sqlite for some reason they are:
3.5527136788005e-15, 0, -3.5527136788005e-15

I thing this can be a bug on calculation of doubles.

Regards,
Israel Lins Albuquerque
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to