I implemented a decimal type in Sqlite.  It uses fixed point and correct 
rounding rules.  To my mind it is an essential component if one is using 
Sqlite for commerical purposes and must have accurate financial information.

jonwood wrote:
> 
> Brad Stiles-2 wrote:
> 
>>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.
>>
> 
> 
> Yeah, I ended up researching the Decimal data type a little and see it often
> does what you described. It's hard for me to know exactly what kind of
> issues may come up in my reporting, but it sounds like that's the safest
> approach. Thanks!

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

Reply via email to