monetary applications [was: Python GUI app to impress the bos s?]

Paul Rubin phr-n2002b at NOSPAMnightsong.com
Fri Sep 20 00:03:40 EDT 2002


Dennis Lee Bieber <wlfraed at ix.netcom.com> writes:
>         The only language I've ever encountered that had a truely monetary 
> safe fixed point data type is COBOL -- which has always used packed BCD 
> formats (though where the sign "bit" is stored may vary). COBOL was 
> created from the beginning for "business" applications (heck: COmmon 
> Business Oriented Language) and was spec'd by a government team. My 
> college mainframe required /four/ of the sixteen registers to hold 
> /one/ BCD number (32 BCD digits, 2 digits/byte, 16bytes @ 4/register).

I'm finding it hard to imagine how any real-world financial
calculation using IEEE doubles could be off by as much as a penny.

BCD doesn't guarantee accuracy either.  If you do a compound interest
calculation in BCD and in IEEE floating point, the floating point
answer will probably be more accurate.



More information about the Python-list mailing list