09-265
To: J3
From: Malcolm Cohen
Subject: Interp F03/0078
Date: 2009 July 27
1. Introduction
This paper contains a proposed answer to F03/0078.
2. Interpretation request
----------------------------------------------------------------------
NUMBER: F03/0078
TITLE: IEEE_SUPPORT_DATATYPE vs. mathematical equivalence
KEYWORDS: IEEE_SUPPORT_DATATYPE, mathematical equivalence
DEFECT TYPE: Interpretation
STATUS: J3 consideration in progress
QUESTION:
Does the function IEEE_SUPPORT_DATATYPE
(Section 14.8) override the mathematical
equivalence rule (Section 7.1.8.3)?
For example, could the program
PROGRAM MAIN
USE, INTRINSIC :: IEEE_ARITHMETIC
USE, INTRINSIC :: IEEE_FEATURES
X = 2.0 + 2.0
PRINT *, X
END
be executed as
PROGRAM MAIN
USE, INTRINSIC :: IEEE_ARITHMETIC
USE, INTRINSIC :: IEEE_FEATURES
X = 220.0*(1.0/55.0)
PRINT *, X
END
if IEEE_SUPPORT_DATATYPE(X) is .TRUE.?
Background:
The committee recently ruled that 2.0 + 2.0 must produce the value 4.0
if IEEE_ARITHMETIC is in effect. I agree that if the particular
operation the processor implements is addition of 2.0 and 2.0, the
result must be 4.0. However, if IEEE_ARITHMETIC does not override the
mathematical equivalence rule, the requirement is essentially
meaningless, since there is no assurance that the expression in the
program is the expression that will be evaluated.
ANSWER:
No, the mathematical equivalence rule is not overridden by USE of the
IEEE_ARITHMETIC or IEEE_FEATURES modules. Doing so would prevent many
benign and useful compiler optimizations and thus have an
unnecessarily deleterious effect on performance.
The mathematical equivalence displayed in the example is not a
reasonable one, but deciding which mathematical equivalences are
reasonable or not is outwith the scope of the standard.
EDITS:
None.
SUBMITTED BY: Michael Ingrassia
HISTORY: 06-124 m175 F03/0078 submitted
09-265 m189 Proposed answer
----------------------------------------------------------------------
===END===