As I remember PL/1 from the 1980s (and very definitely pre-LE) the rules
for implicit conversions were well-defined, but needed care. Simply adding
parentheses would allow me to control the use of integer operations.

I'll be watching for more recent (relevant) exerience :-)

Rupert

On Sun., Sep. 6, 2020, 14:07 Paul Gilmartin, <
0000000433f07816-dmarc-requ...@listserv.ua.edu> wrote:

> 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