J3/04-283
Date: 14 April 2004
To: J3/WG5
Subject: Interpretation request: Representation method of result of REAL
From: Van Snyder
NUMBER: TBD
TITLE: Representation method of result of REAL.
KEYWORDS: "Representation method" KIND REAL.
DEFECT TYPE: Interpretation.
STATUS: J3 consideration in progress.
QUESTIONS:
Subclause numbers refer to 97-007r2.
The second and third sentences of subclause 4.3.1.2 are
A processor shall provide two or more approximation methods that
define sets of values for data of type real. Each such method has
a representation method and is characterized by a value for a type
parameter called the kind type parameter.
1. Does this imply that there is a one-to-one correspondence between kind
type parameter values and representation methods?
Since the second quoted sentence says "a value," not "some values,"
assume the answer to this question is "yes."
Subclause 7.1.4.2 specifies the type and kind type paramter value for the
result of an operation.
2. Is a processor allowed to use a representation method that corresponds
to a different kind type parameter value of the same type, or no kind
type parameter value, at least if neither the precision nor exponent
range of the different representation method is less than the one
specified in 7.1.4.2?
Subclause 7.1.4.1 specifies the type and kind type paramter value for a
variable.
3. Is a processor allowed to use a representation method that corresponds
to a different kind type parameter value of the same type, or no kind
type parameter value, at least if neither the precision nor exponent
range of the different representation method is less than the one
specified in 7.1.4.1?
Subclause 7.1.4.1 specifies the type and kind type paramter value for a
result of a function.
4. Is a processor allowed to use a representation method that corresponds
to a different kind type parameter value of the same type, or no kind
type parameter value, at least if neither the precision nor exponent
range of the different representation method is less than the one
specified in 7.1.4.1?
Subclause 13.14.28 specifies that the result of DBLE is the same as the
result of REAL with a KIND argument having the value KIND(0.0d0).
Subclause 13.14.88 specifies that the kind type parameter value of the
result of REAL is that specified by the KIND argument.
5. Is a processor allowed to use a representation method for the result
that corresponds to a different kind type parameter value of the same
type, or no kind type parameter value, at least if neither the precision
nor exponent range of the different representation method is less than
the one specified in 13.14.88?
ANSWERS:
1. Yes, but there should be exceptions, to allow the recommended answers
for the questions below.
2. No, but it probably ought to be yes. Otherwise, a processor cannot
retain intermediate results of expression evaluation in registers that
have additional range or precision.
3. No, but it probably ought to be yes. Otherwise, inter-statement
optimizations that result in leaving expression results in registers that
have additional range or precision from one statement to another, that
is, those in which stores are eliminated, would be prohibited.
4. No, but it probably ought to be yes, at least in limited
circumstances. Otherwise, if the answer to Question 2 is as specified
above, a function reference that is replaced by the text of the
function's body would have different performance and different results
from one automatically inlined by the processor.
5. No.
Ideally, the answers to Questions 2 through 5 should be "it depends," and
a construct should be provided to specify where "it depends" applies. But
that would be a feature request, not an interpretation request.
EDITS:
In the third sentence in subclause 4.3.1.2, replace "and" by ". Each
representation method" and replace "a value" by "at most one value". At
the end of that sentence insert "; a processor may provide repre-
sentation methods that are not characterized by any kind type parameter
value". After that sentence, insert a new sentence: "With exceptions
specified in 7.1.4.1 and 7.1.4.2, each kind type parameter value
specifies one representation method, which shall be used to represent
constants of the specified kind."
In the first sentence of the second paragraph of 4.3.1.3, replace
"approximation" by "representation". Replace the second sentence by "A
kind type parameter may be specified for a complex entity; it specifies
the kind type parameter value for both the real and imaginary parts."
Then insert a new sentence: "With the exceptions specified in 7.1.4.1,
the representation method (4.3.1.2) of the real and imaginary parts of
the entity shall be the same as a constant of type real having the same
kind type parameter value." In the third sentence, insert "value" after
"parameter".
At the end of each of subclauses 5.1.1.1, 5.1.1.2 and 5.1.2.3, insert the
same new sentence: "With the exceptions specified in 7.1.4.1, the
representation method (4.3.1.2) of the entity shall be the same as a
constant having the same kind type parameter value."
At the end of the first paragraph of subclause 7.1.4.1, add two new
sentences: "If the variable is of type real, the representation method
(4.3.1.2) shall be the same as a constant having the same kind type
parameter value, or may be one that has greater exponent range, greater
precision, or both; this representation method may correspond to a
different kind type parameter, or to no kind type parameter. If the
primary is a reference to a functon other than REAL and the result is of
type real, the representation method shall be the same as a constant
having the same kind type parameter value, or may be one that has greater
exponent range, greater precision, or both; this representation method
may correspond to a different kind type parameter value, or to no kind
type parameter value."
Ideally, the third paragraph of subclause 7.1.4.2 should be rewritten --
it has been in the FCD -- or taken out and shot. Failing that, before the
sentence that begins "In the case that both operands are of type
integer..." insert a new sentence: "If the type of the expression is
real, the representation method (4.3.1.2) shall be the same as a constant
having the same kind type parameter value, or may be one that has greater
exponent range, greater precision, or both; this representation method
may correspond to a different kind type parameter value, or to no kind
type parameter value."
After the Result characteristics section of subclause 13.14.20, insert a
note:
NOTE 13.7a
The repesentation method (4.3.1.2) of the real and imaginary parts of
the result shall be the same as a constant of type real having the
same kind type parameter value as the result.
After Case (ii) in the Result characteristics section of subclause
13.14.88, insert a note:
NOTE 13.13b
The repesentation method (4.3.1.2) of the result shall be the same as
a constant of type real having the same kind type parameter value as
the result.
SUBMITTED BY: Van Snyder
HISTORY: 04-283 m168 submitted