Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss] Financial database / balance?



On 1/14/2012 9:44 AM, Jerry Feldman wrote:
> But, Richard Pieri has a very good point about BCD (Binary Coded
> Decimal). The problem with BCD is that it is generally not supported in
> any common microprocessor that I am aware of, but you can use a 64 bit
> int and scale it. Using a 64-bit integer you are not going to lose any
> precision as a LONG_MAX is

Implementing a BCD math library isn't difficult.  It certainly would be 
slower than using native INTs and FLOATs but not devastatingly so.

You can use INTs as Jerry suggests and pretend that decimals don't exist 
except for display purposes.  So, for example, $1,524.79 would be stored 
as 1524790 which gives you three places of decimal precision (mils).

-- 
Rich P.



BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org