BTW: The FROM clause is optional in SQLite. It is required only for expressions 
involving fields.

SELECT 2/4 AS RESULT;

Will also work, without the overhead of accessing every row of TABLE and 
performing DISTINCT processing and maybe even without obtaining a lock on the 
database.

-----Ursprüngliche Nachricht-----
Von: Gene Connor [mailto:neothreeei...@hotmail.com]
Gesendet: Mittwoch, 30. April 2014 06:21
An: sqlite-users@sqlite.org
Betreff: [sqlite] Bug in division?


SELECT DISTINCT 2/4 AS RESULT FROM TABLE;returns 0 SELECT DISTINCT 2/4.0 AS 
RESULT FROM TABLE;returns 0.5 (correct) SELECT DISTINCT 2.0/4 AS RESULT FROM 
TABLE;returns 0.5 (correct) SELECT DISTINCT 2.0/4.0 AS RESULT FROM 
TABLE;returns 0.5 (correct) SELECT DISTINCT 2.0/4.01 AS RESULT FROM 
TABLE;returns 0.49875 (correct) As long as one or both numbers has at least one 
decimal place, it calcs correctly.
Verified that it also happens in queries using tables and real data.
Windows SQLite version 3.8.4.3 2014-04-03 16:53:12

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


-----------------------------------------------------------------------
Gunter Hick
Software Engineer

Scientific Games International GmbH
Klitschgasse 2 – 4, A - 1130 Vienna,
Austria
FN 157284 a, HG Wien
Tel: +43 1 80100 0
E-Mail: h...@scigames.at

This e-mail is confidential and may well also be legally privileged. If you 
have received it in error, you are on notice as to its status and accordingly 
please notify us immediately by reply e-mail and then
delete this message from your system. Please do not copy it or use it for any 
purposes, or disclose its contents to any person as to do so could be a breach 
of confidence. Thank you for your cooperation.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to