On 13 Oct 2009, at 2:07pm, Fred Williams wrote:

> The best way I have found to manage decimal (Business math) with  
> most all
> the databases is to use integers and multiply and divide by the  
> decimal
> offset (i.e. 10, 100, 1000) for presentation purposes,  doing my own
> "bankers rounding"  in code.  Big hassle, but transports well.

That's the approach that's generally used: all stored numbers are  
integers at the lowest level of valid currency: cents rather than  
dollars, etc..  Still doing the same thing we did when I started  
programming on mainframes.

Another problem with 'business math' is that the US and British  
(therefore Australian, Japanese, etc.) definitions require different  
rounding, days-in-a-year, compounding formulae, etc..  In other words  
a single library of calls which do all your business math for you  
would have to have a 'country' setting to make it useful for all  
users.  And nobody wants to be sued for issuing a library with a bug  
in it because they didn't know some tiny little obscure niggle in one  
country's tax law.  So yes, if you have to satisfy auditors you're  
probably going to have to do your own business maths.  At least that  
way you understand how it all works.

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

Reply via email to