[Python-Dev] Fixed Decimal types

Gordon McMillan gmcm@hypernet.com
Thu, 23 Dec 1999 15:48:56 -0500

Jim Fulton wrote:
> "Da Silva, Mike" wrote:

[AS400 RPG rules...]

> Yee ha! This is great input. Anyone have any other examples of
> what any other systems do? Anyone got a PL/I manual handy. ;)

From memory of IBM COBOL and SQL, the rules for 
intermediates seem similar to what Mike outlines. In both 
cases, the target is pre-specified, and I think by default you 
get auto-rounding.

Tim's BCD class seem to always return the higher precision 
on an arithmetic op, although the intermediate is full precision.
>> However, unlike RPG, we should probably ensure 
>> that attempts to overflow or underflow the scale 
>> result in NaN or Overflow conditions, rather
>> than assuming the user is right and losing 
>> the significant digits.
> Since this would be based on infinite-precision numbers, I don't
> think that this would be an issue.

It's an issue if the result of an arithmetic op is other than "full" 
precision. The issue certainly comes up when you e.g. talk to 
a DB, and it might be better to have it come up sooner rather 
than later.

- Gordon