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: Alain Lucari
Subject: Re: [open-cobol-list] About the Overflow
Date: Thu Jun 2 02:59:41 2005

Hello Peg,

It seem that the problem come with your "mf" flavour
and perhaps with Cygw.
I am not able to see that : I use Linux and an old 
version of Open-Cobol without "flavours".
Perhaps you can try some others flavours ?

Any case, if you want to test overflow don't forgot
the "on size error" clause.


Le Thu, 02 Jun 2005 09:55:16 +0900
Peg <address@hidden> a écrit:

> 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,
> 

Best regards,
-- 
Alain Lucari (Eurlix)


reply via email to

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