On 8 Dec 2013, at 10:21pm, MikeD <supp...@dotysoftware.com> wrote:

> The simple solution is use INTEGER and multiple by .01, but
> extremely interested in how to correctly process money with 2 decimal
> positions.

First, never do this:

> CREATE TABLE IF NOT EXISTS T1(F1,F2,F3,F4,SUBTOTAL);


Always define your column types.  In your case you'd be using either INTEGER or 
REAL.

Second, multiplying by 100 and defining columns as INTEGER to store money to 
two places /is/ the correct solution.  This means that arithmetic will 
automatically be done to two places.  You will have to test whether results are 
rounded or truncated when you do tax calculations but better still would be to 
explicitly use round() when any dividing is done.

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

Reply via email to