I am aware of the various options, all I was saying is that packed decimal is heavily used
for financial calculations. I believe you have to specify COMP-4 to get fixed point
binary, the default USAGE is DISPLAY (for IBM) which is zoned decimal. There are no
instructions to do math on zoned (display) fields, so conversions are done by the compiler
if those fields are used in calculations.
IBM has COMP-5 but I'm not clear from the doc what it does, although it may be more
meaningful on Z since the ADDs support longer binary operands. Prior to Z it seems COMP-5
and COMP-4 would have been the same on IBM implementations.
-----Original Message-----
From: "Chuck Guzis" <cclist at sydex.com>
Sender: cctalk-bounces at
classiccmp.org
Date: Mon, 24 Oct 2011 10:24:44
To: General Discussion: On-Topic and Off-Topic Posts<cctalk at classiccmp.org>
Reply-To: "General Discussion: On-Topic and Off-Topic Posts"
<cctalk at classiccmp.org>
Subject: Re: Fixed point financial data versus floating point - Re:
Spreadsheets (was Microsoft flamage)
On 24 Oct 2011 at 16:25, Vintage Coder wrote:
Decimal math (hardware supported) is used heavily in
financial
processing with IBM COBOL. No loss of precision because the type is
base 10. BCD is very similar to what IBM calls "packed decimal".
Only COMP-3 was packed decimal; COMP-1 and COMP-2 are single- and
double-precision real/floating/binary exponential. All others are
usually internally integers (scaled where a point is specified)
unless DISPLAY, which is kept as decimal character.
Some COBOLs have other data types such as BINARY-DOUBLE, COMP-5 and
explicit specifications such as PACKED-DECIMAL.
--Chuck