prePEP: Money data type

John Roth newsgroups at jhrothjr.com
Sat Oct 18 13:50:42 EDT 2003


"Paul Rubin" <http://phr.cx@NOSPAM.invalid> wrote in message
news:7xr81a7crd.fsf at ruckus.brouhaha.com...
> "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.

Like I said, you do it your way. That is, write the necessary COBOL
code to round it the way you want. Ths is not as easy as it sounds
since COBOL is completely lacking in the basic abstraction facilities
such as subroutines with parameters within a single Procedure Division.

John Roth






More information about the Python-list mailing list