[Discuss] Financial database / balance?

Jerry Feldman gaf at blu.org
Sun Jan 15 11:44:30 EST 2012


On 01/15/2012 11:06 AM, Richard Pieri wrote:
> On Jan 15, 2012, at 8:07 AM, Jerry Feldman wrote:
>> Actually, most spreadsheets use doubles.
> Yes, they do, and Microsoft has a support page of workarounds for IEEE rounding errors in various versions of Excel because of them:
> http://support.microsoft.com/kb/214118
>
True. I complained about this back when I was at Cadmus. Essentially,
IEEE double precision is only accurate up to 15 decimal digits, and as
both of us presented, the conversion of a decimal number to a binary
number (mantissa/exponent) yields some inaccuracies. even with BCD you
can have rounding errors. I worked on a general ledger system that
actually kept track of rounding errors and posted that in the balance
sheet. But, for personal finance (IMHO) floats or doubles should be
perfectly alright if you know the limitations. Some systems convert
floats to decimal for storage. And I won't go into endian issues.

So, while the OP could certainly use canned BCD libraries or integers,
using floats and doubles should work fine for most personal stuff.

Also, I prefer using doubles rather than floats (32-bits) because most
chips have 64-bit floating point hardware.

-- 
Jerry Feldman <gaf at blu.org>
Boston Linux and Unix
PGP key id:3BC1EB90 
PGP Key fingerprint: 49E2 C52A FC5A A31F 8D66  C0AF 7CEA 30FC 3BC1 EB90




More information about the Discuss mailing list