> jonwood wrote:
> I've done very little programming related to currency (dollars,
> etc.) and I'm wondering if I need to worry about rounding errors. 
> Since SQLite doesn't appear to have a currency type, I had planned 
> on using REAL instead. But I have a lot of reports to print out and 
> I could see rounding errors with REAL.

That's a very real possibility.  I'll second your idea, and Dennis'
recommendation, to use an integer type for this (unless you are using a
compiler that has a scaled integer or dedicated currency type).  In
addition, you might consider storing at least one more digit than
pennies, to keep your fractional pennies, if you need to do that.  I
once had a system where I was required to keep thousandths of pennies,
and we used this method.  The vast majority of numbers had no fractional
pennies, so $10.00 looked like 1000000, but that's the way it had to be.

Brad

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

Reply via email to