On 12 May 2013, at 11:07am, Paul van Helden <p...@planetgis.co.za> wrote:
> SELECT 1/2 returns 0 which to me is a little odd, but I see from this page: > http://www.sqlite.org/sqllogictest/wiki?name=Differences+Between+Engines > that most other engines do the same. A few year ago I was debugging ridiculous behaviour in a huge app and found to my dismay the same problem in C. Evaluate 1/9 and you get zero. You have to use 1.0/9 or 1/9.0 for a floating point result. And hey presto: SQLite version 3.7.12 2012-04-03 19:43:07 Enter ".help" for instructions Enter SQL statements terminated with a ";" sqlite> SELECT 1/2; 0 sqlite> SELECT 1/2.0; 0.5 sqlite> SELECT 1.0/2; 0.5 sqlite> I think it's endemic to computers, the same as the difficulty with counting in units of 0.1 until you get 1. Simon. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users