Re: PL/I integers: Constant Identifiers
If you declare a variable with maximal precision for one compiler and later compile it on a compiler with longer maximal precision, you get digits (bits) after the decimal (binary) point, Is it your position that FIXED variables are integers in one compiler but not in the other? -- Shmuel (Seymour J.) Metz http://mason.gmu.edu/~smetz3 From: IBM Mainframe Discussion List on behalf of Robin Vowels Sent: Wednesday, September 9, 2020 10:24 AM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: PL/I integers: Constant Identifiers From: "Seymour J Metz" 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.33 1 6 */ From: IBM Mainframe Discussion List on behalf of Paul Gilmartin <000433f07816-dmarc-requ...@listserv.ua.edu> Sent: Saturday, September 5, 2020 11:33 PM To: IBM-MAIN@LISTSERV.UA.EDU 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 lists...@listserv.ua.edu with the message: INFO IBM-MAIN -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu 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 lists...@listserv.ua.edu with the message: INFO IBM-MAIN -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: PL/I integers: Constant Identifiers
From: "Seymour J Metz" 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.33 1 6 */ From: IBM Mainframe Discussion List on behalf of Paul Gilmartin <000433f07816-dmarc-requ...@listserv.ua.edu> Sent: Saturday, September 5, 2020 11:33 PM To: IBM-MAIN@LISTSERV.UA.EDU 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 lists...@listserv.ua.edu with the message: INFO IBM-MAIN -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu 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 lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: PL/I integers (was: Constant Identifiers)
What release of what compiler. I remember when IBM changed the default for FIXED BIN from (31,0) to (15,0) in order to eliminate some annoying anomalies that didn't occur in FORTRAN. Of course, back in those days there were fewer compiler options to muddy the waters. -- Shmuel (Seymour J.) Metz http://mason.gmu.edu/~smetz3 From: IBM Mainframe Discussion List on behalf of Bob Bridges Sent: Monday, September 7, 2020 10:48 AM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: PL/I integers (was: Constant Identifiers) All of this is really fascinating (and no, I'm not being facetious): A bunch of apparently knowledgeable PL/1 programmers cannot agree on a point that would seem to have a single indisputable answer. Rather than keep on saying "yes it is" / "no it isn't", couldn't one or two of you from both sides run a program demonstrating your claim? It would probably be necessary to define the compiler you're running, too. --- Bob Bridges, robhbrid...@gmail.com, cell 336 382-7313 /* Oh good. Now he'll be bi-ignorant. -Texas Agriculture Commissioner Jim Hightower when told that Texas Governor Bill Clements had been studying Spanish */ -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: PL/I integers
... and the compile options On 2020-09-07 10:48, Bob Bridges wrote: All of this is really fascinating (and no, I'm not being facetious): A bunch of apparently knowledgeable PL/1 programmers cannot agree on a point that would seem to have a single indisputable answer. Rather than keep on saying "yes it is" / "no it isn't", couldn't one or two of you from both sides run a program demonstrating your claim? It would probably be necessary to define the compiler you're running, too. --- Bob Bridges, robhbrid...@gmail.com, cell 336 382-7313 /* Oh good. Now he'll be bi-ignorant. -Texas Agriculture Commissioner Jim Hightower when told that Texas Governor Bill Clements had been studying Spanish */ -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN . -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: PL/I integers
On 2020-09-08 00:15, Seymour J Metz wrote: Did you read what I wrote? The code you wrote has nothing to do with the expression I gave. Oops, a typo. The PUT should have read PUT ( (I/J)*6 ); to produce 6. How about DECLARE (I, J) FIXED DECIMAL (15); I = 4; J = 3; PUT ((I/J*J)); That's nothing like what you wrote. You wrote (4/3)*6 From: IBM Mainframe Discussion List on behalf of Robin Vowels Sent: Monday, September 7, 2020 5:49 AM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: PL/I integers (was: Constant Identifiers) On 2020-09-07 16:13, Seymour J Metz wrote: PL/I has never had integers. You are still wrong. Recently you have made numerous erroneous claims about PL/I. 4 is an integer in PL/I. 3 is an integer in PL/I. The arithmetic rules for scaled fixed point are different from those for integers. Scaled, with a scale factor other than zero and with a fractional part, yes, because they are not then integers. However, with scale factor of zero, they are integers. In integer arithmetic, (4/3)*6 is 6 That's not the result you get in PL/I. With the following declarations, you'll get the same result in PL/I, namely, 6: DECLARE (I, J) FIXED DECIMAL (15); I = 4; J = 3; PUT (I/J); will print 6 -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: PL/I integers (was: Constant Identifiers)
All of this is really fascinating (and no, I'm not being facetious): A bunch of apparently knowledgeable PL/1 programmers cannot agree on a point that would seem to have a single indisputable answer. Rather than keep on saying "yes it is" / "no it isn't", couldn't one or two of you from both sides run a program demonstrating your claim? It would probably be necessary to define the compiler you're running, too. --- Bob Bridges, robhbrid...@gmail.com, cell 336 382-7313 /* Oh good. Now he'll be bi-ignorant. -Texas Agriculture Commissioner Jim Hightower when told that Texas Governor Bill Clements had been studying Spanish */ -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: PL/I integers (was: Constant Identifiers)
"DECLARE (I, J) FIXED DECIMAL (15); I = 4; J = 3; PUT ((I/J*J));" Well, just doing the math, that should give an answer of 4. 4/3 * 3/1 = 4/1 = 4 ... Joe On Mon, Sep 7, 2020 at 9:15 AM Seymour J Metz wrote: > Did you read what I wrote? The code you wrote has nothing to do with the > expression I gave. How about > > DECLARE (I, J) FIXED DECIMAL (15); > I = 4; J = 3; > PUT ((I/J*J)); > > > -- > Shmuel (Seymour J.) Metz > http://mason.gmu.edu/~smetz3 > > > > From: IBM Mainframe Discussion List on behalf > of Robin Vowels > Sent: Monday, September 7, 2020 5:49 AM > To: IBM-MAIN@LISTSERV.UA.EDU > Subject: Re: PL/I integers (was: Constant Identifiers) > > On 2020-09-07 16:13, Seymour J Metz wrote: > > PL/I has never had integers. > > You are still wrong. > > Recently you have made numerous erroneous claims about PL/I. > > 4 is an integer in PL/I. > 3 is an integer in PL/I. > > > The arithmetic rules for scaled fixed > > point are different from those for integers. > > Scaled, with a scale factor other than zero and with > a fractional part, yes, because they are not then integers. > However, with scale factor of zero, they are integers. > > > In integer arithmetic, > > (4/3)*6 is 6 That's not the result you get in PL/I. > > With the following declarations, you'll get the same > result in PL/I, namely, 6: > DECLARE (I, J) FIXED DECIMAL (15); > I = 4; J = 3; > PUT (I/J); > will print 6 > > > > > From: IBM Mainframe Discussion List on > > behalf of Robin Vowels > > Sent: Sunday, September 6, 2020 7:06 PM > > Subject: Re: Constant Identifiers > > > > - Original Message - > > From: "Seymour J Metz" > > To: > > 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 result > > is FIXED DECIMAL, not binary. > > -- > For IBM-MAIN subscribe / signoff / archive access instructions, > send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN > > -- > For IBM-MAIN subscribe / signoff / archive access instructions, > send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN > -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: PL/I integers (was: Constant Identifiers)
Did you read what I wrote? The code you wrote has nothing to do with the expression I gave. How about DECLARE (I, J) FIXED DECIMAL (15); I = 4; J = 3; PUT ((I/J*J)); -- Shmuel (Seymour J.) Metz http://mason.gmu.edu/~smetz3 From: IBM Mainframe Discussion List on behalf of Robin Vowels Sent: Monday, September 7, 2020 5:49 AM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: PL/I integers (was: Constant Identifiers) On 2020-09-07 16:13, Seymour J Metz wrote: > PL/I has never had integers. You are still wrong. Recently you have made numerous erroneous claims about PL/I. 4 is an integer in PL/I. 3 is an integer in PL/I. > The arithmetic rules for scaled fixed > point are different from those for integers. Scaled, with a scale factor other than zero and with a fractional part, yes, because they are not then integers. However, with scale factor of zero, they are integers. > In integer arithmetic, > (4/3)*6 is 6 That's not the result you get in PL/I. With the following declarations, you'll get the same result in PL/I, namely, 6: DECLARE (I, J) FIXED DECIMAL (15); I = 4; J = 3; PUT (I/J); will print 6 > > From: IBM Mainframe Discussion List on > behalf of Robin Vowels > Sent: Sunday, September 6, 2020 7:06 PM > Subject: Re: Constant Identifiers > > - Original Message - > From: "Seymour J Metz" > To: > 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 result > is FIXED DECIMAL, not binary. -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: PL/I integers (was: Constant Identifiers)
On 2020-09-07 16:13, Seymour J Metz wrote: PL/I has never had integers. You are still wrong. Recently you have made numerous erroneous claims about PL/I. 4 is an integer in PL/I. 3 is an integer in PL/I. The arithmetic rules for scaled fixed point are different from those for integers. Scaled, with a scale factor other than zero and with a fractional part, yes, because they are not then integers. However, with scale factor of zero, they are integers. In integer arithmetic, (4/3)*6 is 6 That's not the result you get in PL/I. With the following declarations, you'll get the same result in PL/I, namely, 6: DECLARE (I, J) FIXED DECIMAL (15); I = 4; J = 3; PUT (I/J); will print 6 From: IBM Mainframe Discussion List on behalf of Robin Vowels Sent: Sunday, September 6, 2020 7:06 PM Subject: Re: Constant Identifiers - Original Message - From: "Seymour J Metz" To: 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 result is FIXED DECIMAL, not binary. -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN