On 2020-09-06 13:07, Paul Gilmartin 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 && ./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?
No, if the receiving variable is an integer without fractional part, PL/I
truncates.
The Language Ref. properly cautions that a constant declaration may
be necessary to control the constant types.
Anyway, the latest versions of EPLI contain the (NO)DECOMP option:
The DECOMP option instructs the compiler to generate a listing section that
gives a decomposition of expressions used in the compilation.
Under the DECOMP option, the compiler generates a listing section that shows all
intermediate expressions and their attributes for all expressions used in the
source program. Under the NODECOMP option, the compiler does not generate this
listing section.
The default is NODECOMP.
and
Expressions and attributes listing
If you use the DECOMP compiler option, the compiler includes, in the compiler
listing, a section that shows all intermediate expressions and their attributes
for all expressions used in the source program.
Never used it, but it maybe useful to do so before drawing erroneous conclusions
about output!
Robert
--
Robert AH Prins
robert.ah.prins(a)gmail.com
The hitchhiking grandfather - https://prino.neocities.org/indez.html
Some REXX code for use on z/OS - https://prino.neocities.org/zOS/zOS-Tools.html
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN