POV-Ray : Newsgroups : povray.off-topic : COBOL Wow : Re: COBOL Wow Server Time
29 Sep 2024 19:23:49 EDT (-0400)
  Re: COBOL Wow  
From: clipka
Date: 13 Apr 2009 20:15:00
Message: <web.49e3d4aa11354d362dae03a10@news.povray.org>
Darren New <dne### [at] sanrrcom> wrote:
> > anyway, is it much of a hassle to use double to represent monetary values?
>
> Yes. It's not correct.  Add up a billion dollars in penny increments, and
> tell me you can guarantee it's right.

To my knowledge that's not even the main issue:

Science cares about high precision.

Business doesn't give a damn about high precision, as long as rounding rules are
precisely followed.

Ever seen a "pocket" calculator for business use? They have extra switches to
set the rounding mode, e.g. fixed two digits, fixed five digits, or
what-have-you.

I once had to hack up some programs to run plausibility checks on records in an
insurance company "database" (well, individual files, but what the heck...
those were the database for the "worst case" contracts, that had been the last
to be ported to some newer software that hadn't been able to handle them
earlier, due to a lot of exceptional parameters in them).

I guess there wasn't a single record in the database where the plausibility
check did compute a perfect match for the values in the database. Not because
my program would have been imprecise - but because for simplicity I had left
out a huge number of rounding rules that I would have had to add otherwise.

In COBOL, the rounding rules are automatically enforced by the data format
description in the WORKING STORAGE SECTION.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.