Since when is 1.33... an integer?
-- Shmuel (Seymour J.) Metz http://mason.gmu.edu/~smetz3 ________________________________________ From: IBM Mainframe Discussion List <[email protected]> on behalf of Robin Vowels <[email protected]> Sent: Wednesday, September 9, 2020 10:08 AM To: [email protected] Subject: Re: PL/I Integer arithmetic (was: Constant Identifiers) From: "Seymour J Metz" <[email protected]> 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 */ And under Rules (ans): %PROCESS RULES(ANS); 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 */ As you can see, the results are the same under IBM and ANS rules. ________________________________________ From: IBM Mainframe Discussion List <[email protected]> on behalf of Robin Vowels <[email protected]> Sent: Sunday, September 6, 2020 7:06 PM Subject: Re: Constant Identifiers ----- Original Message ----- From: "Seymour J Metz" <[email protected]> Sent: Monday, September 07, 2020 5:33 AM > PL/I doesn't have integers. PL/I has always had integers. > The ratiio 4/3 is FIXED BIN, No it not. It is FIXED DECIMAL -- as I said a few days ago. And it hasn't changed since. > with some number of bits after the binary point. DECIMAL digits after the decimal point, because the reault is FIXED DECIMAL, not binary. --- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
