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 <IBM-MAIN@LISTSERV.UA.EDU> on behalf of 
Robin Vowels <robi...@dodo.com.au>
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" <sme...@gmu.edu>
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 <IBM-MAIN@LISTSERV.UA.EDU> on behalf of 
Paul Gilmartin
<0000000433f07816-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

Reply via email to