[Discuss] Financial database / balance?

markw at mohawksoft.com markw at mohawksoft.com
Sat Jan 14 13:23:31 EST 2012


> 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).

That's a HORRIBLE idea! 3 decimal places are worse that IEEE. If it just a
home accounting package, use doubles. If it is for the banking industry
use a financial math library.

Look for a quantitative financial library.
>
> --
> Rich P.
> _______________________________________________
> Discuss mailing list
> Discuss at blu.org
> http://lists.blu.org/mailman/listinfo/discuss
>





More information about the Discuss mailing list