On 2020-09-10 00:33, Seymour J Metz wrote:
Since when is 1.33... an integer?

Who said it was?

A/B (both integers with values 4 and 3 respectively),
yield exactly 1.

________________________________________
From: IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU> on
behalf of Robin Vowels <robi...@dodo.com.au>
Sent: Wednesday, September 9, 2020 10:08 AM
Subject: Re: PL/I Integer arithmetic (was: Constant Identifiers)

From: "Seymour J Metz" <sme...@gmu.edu>
Sent: Monday, September 07, 2020 4:13 PM


PL/I has never had integers.

It always has had integers.

The arithmetic rules for scaled fixed point are different from those for integers. In integer arithmetic, (4/3)*6 is 6 That's not the result you get in PL/I.

Yes it is, with declarations as shown, as I said before, .

Under IBM rules:

%PROCESS RULES(IBM);
INTEGER_DIVISION:
   PROCEDURE OPTIONS (MAIN);
   DECLARE (A, B) FIXED DECIMAL (15);

   A = 4; B = 3;

   PUT (4/3);
   PUT (A/B);
   PUT ( (A/B) * 6 );

END INTEGER_DIVISION;
/* RESULTS:
  1.33333333333333                       1                       6
*/

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to