From: "Seymour J Metz" <[email protected]>
Sent: Monday, September 07, 2020 5:33 AM
PL/I doesn't have integers.
It does.
Believe it or not, the constants 4 and 3 that you wrote in the
next sentence are decimal INTEGERS.
The ratiio 4/3 is FIXED BIN,
with some number of bits after the binary point.
No. The division of DECIMAL constants can never produce a
BINARY result.
See the result of 4/3 appended to the program.
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
*/
________________________________________
From: IBM Mainframe Discussion List <[email protected]> on behalf of Paul Gilmartin
<[email protected]>
Sent: Saturday, September 5, 2020 11:33 PM
To: [email protected]
Subject: Re: Constant Identifiers
On Sat, 5 Sep 2020 08:13:42 +1000, Robin Vowels wrote:
As for writing formulas, I prefer to follow a well-known formula, thus:
volume = 4/3 * 3.14159 * radius**3
Beware! Than might left-associate as:
volume = ( 4/3 ) * 3.14159 * radius**3
... and the quotient of integers, 4/3, is 1.
However, if I'm interested in efficiency, I'd prefer
volume = 4 * 3.14159E0 / 3 * radius**3
... (and correct.)
-- gil
----------------------------------------------------------------------
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
---
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