The default type for 3 and 4 is FIXED BINARY. PL/I does not have an integer 
type, but the DIVIDE() BIF can be used to do an integer divide, and assigning a 
quotient to a FIXED BIN(foo,0) variable may do what you want, depending on 
precision issues. 

--
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3


________________________________________
From: IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU> on behalf of 
Paul Gilmartin <0000000433f07816-dmarc-requ...@listserv.ua.edu>
Sent: Sunday, September 6, 2020 9:07 AM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: Constant Identifiers

On Sun, 6 Sep 2020 17:25:45 +1000, Robin Vowels wrote:
>>>
>> Beware!  Than might left-associate as:
>>     volume = ( 4/3 ) * 3.14159 * radius**3
>> ... and the quotient of integers, 4/3, is 1.
>
>No it's not. 4/3 yields 1.33333333333333.. to 15 digits in PL/I.
>You're thinking of FORTRAN.
>
And C:
662 $ cat typetest.c
#include <stdio.h>
int main() {
    printf( "%10.6f\n",   4/3 * 3.14159 );
    printf( "%10.6f\n", 4.0/3 * 3.14159 ); }
663 $ gmake typetest &&amp; ./typetest
cc     typetest.c   -o typetest
  3.141590
  4.188787

It ought to depend on the types of the operands of the polymorphic
operator, '/'.  What are the default types of '4' and '3'?  Does PL/I
entirely lack an integer divide?

The Language Ref. properly cautions that a constant declaration may
be necessary to control the constant types.

-- 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

Reply via email to