gnucobol-users
[Top][All Lists]
Advanced

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

[open-cobol-list] Re: Cobol division


From: Roger While
Subject: [open-cobol-list] Re: Cobol division
Date: Wed Mar 2 09:13:26 2005

Bill, care to comment on this ?
Here's what I have found out so far -
OC, MF and ACU all produce the same results for this.
From the 2002 standard 14.6.6 Arithmetic statements :
...
The composite of operends is a hypothetical data item resulting
from the superimposition of specified operands aligned on their
decimal points.
....
Because of the division, this would imply 2 decimal places. (Bill ?)
So, I would say say we are doing the correct thing.

Roger

> The IBM MVS compiler has some rules to decide when to use
> integer division and when to use floating point division.
> OpenCobol only seems to support floating point division.
> With the MVS Cobol compiler
>    IF      100*(X/100) = X
>    THEN    DISPLAY 'X=' X
>    END-IF
> will only output X when X is a multiple of 100 because it
> does integer division for X/100.
> Note that
>    COMPUTE  Y = 100*(X/100)
> will give different values depending on whether Y is declared
> as S9(9) or S9(9)V9(2).




reply via email to

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