monetary applications [was: Python GUI app to impress the bos s?]
Dennis Lee Bieber
wlfraed at ix.netcom.com
Thu Sep 19 17:20:28 EDT 2002
Paul Boddie fed this fish to the penguins on Thursday 19 September 2002
01:14 am:
> It could well be that not many people do financial database
> programming in Python, bizarre and unlikely as that may seem. Taking a
> look at pyPgSQL, as the only database module I have installed that
> actually readily documents such things (and that should tell you
> something), it would seem that monetary amounts are converted to
> floating point numbers - surely the first thing one would want to
> avoid in manipulating financial data. Perhaps people use integers, or
> perhaps other modules provide better decimal support.
>
If I recall from the c.l.ada group, GNAT's "fixed point" data type is
implemented as scaled integers, so even that might not pass the spec
for a monetary type. My VB references are on loan (or currently stuck
in the Windows environment and unreadable on Linux) so I can't recall
what VB6 had for fixed/monetary.
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).
--
> ============================================================== <
> wlfraed at ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG <
> wulfraed at dm.net | Bestiaria Support Staff <
> ============================================================== <
> Bestiaria Home Page: http://www.beastie.dm.net/ <
> Home Page: http://www.dm.net/~wulfraed/ <
More information about the Python-list
mailing list