gnucobol-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [open-cobol-list] About the Overflow


From: Peg
Subject: Re: [open-cobol-list] About the Overflow
Date: Wed Jun 1 17:57:25 2005
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

Hello Alain Lucari,
Alain Lucari wrote:
There is no more problem with compute or subtract
than with add.

The problem is :
- no "on size error" in your samples,
- your pic 9(2) is UNSIGNED :
  1 - 3 = -2
 unsigned, the result is 2
 There is no overflow in this case !
Thank you for a detailed explanation.

Right. I was misunderstanding it.
this overflow works perfectly as expected.

When thinking about the problem again
As for it, I noticed there was no relation as the overflow.

------------------------------
WORKING-STORAGE SECTION.
01 DATA1 PIC 9(2) VALUE 5.
01 DATA2 PIC 9(2) VALUE 5.
PROCEDURE DIVISION.
COMPUTE DATA1 = DATA1 - 1.
SUBTRACT 1 FROM DATA2.
DISPLAY DATA1 DATA2.
$ cobc TESTFLOW.COB -free
$ ./TESTFLOW
04 04

$ cobc TESTFLOW.COB -free -std=mf
04 96
------------------------------

5 - 1 = 96 ?
I do not understand this calculation result.
Am I also misunderstanding anything?

Best regards,

--
Peg, PegStyle mailto:address@hidden
http://members8.tsukaeru.net/pegstyle/
(OpenCOBOL Cygwin/MinGW Binary Download Site.
 But Japanese Page Only)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]