prePEP: Money data type

Paul Rubin http
Sat Oct 18 12:04:54 EDT 2003


"John Roth" <newsgroups at jhrothjr.com> writes:
> COBOL's default rounding policy is to truncate. It has a second
> rounding policy that is invoked by the keyword ROUND (surprise,
> eh?) However, one of the things that COBOL arithmetic has is
> precise control of the number of decimal places at all points in
> a computation[1], so if you don't like either truncation or the effects
> of ROUND, then you simply maintain an additional decimal place
> or two and do it your way.[2]

Yeah, but what about the exact method of rounding, like the pre-PEP
specifies 1.125 rounds down but 1.135 rounds up (or maybe it was the
other way), while some other standard specifies always rounding down
(or up) when the extra digit is a 5.

> [2] Unless that would run you over 18 digits. Why 18, I
> have no idea, and I'm afraid that most of the people on the
> original COBOL committee are no longer with us.

That's obvious, it's how many BCD digits would fit in a doubleword of
the 36-bit machines in use at that time.




More information about the Python-list mailing list