J3/17-105
To: J3
From: Bill Long & John Reid
Subject: Conversion of integer operands for **
Date: 2017 January 04
Discussion:
-----------
In evaluation the expression I4**I8 where I4 is declared
INTEGER(INT32) and I8 is declared INTEGER(INT64), is the processor
expected to convert the I4 operand to INTEGER(INT64) before performing
the computation? I assume an implementation would de this anyway, but
the standard seems vague about the actual semantics.
In the standard we have:
10.1.5.2.1 Interpretation of numeric intrinsic operations
The two operands of numeric intrinsic binary operations may be of
different numeric types or different kind type parameters. Except
for a value raised to an integer power, if the operands have
different types or kind type parameters, the effect is as if each
operand that differs in type or kind type parameter from those of
the result is converted to the type and kind type parameter of the
result before the operation is performed. When a value of type real
or complex is raised to an integer power, the integer operand need
not be converted.
This is vaguely worded for I4**I8. The text says that "except for a
value raised to a power" but then supplies only partial specification
for what happens in the "except" cases (for the value being real or
complex, but not integer). It would be clearer to make the wording
consistent in the two sentences.
Edits to 17-007:
----------------
[156:20] In 10.1.5.2.1 Interpretation of numeric intrinsic operations,
para 1, sentence 2, after "Except for a value" add "of type real or
complex".