HP3000-L Archives

October 1998, Week 4

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Walter Murray <[log in to unmask]>
Reply To:
Walter Murray <[log in to unmask]>
Date:
Wed, 28 Oct 1998 18:45:24 GMT
Content-Type:
text/plain
Parts/Attachments:
text/plain (22 lines)
Ted Ashton ([log in to unmask]) wrote:

[description of a result that is off by .01 when using FUNCTION SUM]

: Could someone spare a moment to explain to me what's going on here?  I thought
: COBOL was "the language which wouldn't lose pennies" !

I'll assume you are using COBOL II/iX.  The SUM function is using
floating-point for its intermediate values, and there is no automatic
rounding when the result is assigned to the receiving operand of the
COMPUTE.  For best results, use the ROUNDED phrase with the SUM function
when dealing with non-integers.

For further information, see page 10-5 of the reference manual,
"Precision of Numeric Functions," and page 3-26 of the programmer's
guide, "Coding Heuristics when Calling COBOL Functions."

Walter Murray
Hewlett-Packard
Support Technology Lab
COBOL II/iX Project

ATOM RSS1 RSS2