(j3.2006) (SC22WG5.4756) [ukfortran] Provisional result of interpretationsballot 3, N1933
N.M. Maclaren
nmm1
Tue Sep 4 04:22:08 EDT 2012
I apologise for continuing this one, but I am afraid that I think that
it is important, and it was something that I was hoping to improve in
the next revision.
On Sep 4 2012, Malcolm Cohen wrote:
>
> I think that F03/0065 ballot result should be "C", since it is 7 Y and
> 2 N.
>From that, I assume that there are no formal rules.
> IMO there is not obviously any new technical content in the No votes
> (F66 and F77 not being exactly new!), but C is ok to defer to J3 to
> confirm that we don't want to revise the answer.
At least you and I are still completely at cross-purposes. My point is
that we have been sweeping this issue under the carpet for the past 50
years, and the direction of its commentary is towards the slippery slope
that we tried but failed to avoid when designing C90 in WG14 :-( Please
don't let Fortran follow the semantic path that C and C++ have taken!
The interpretation is:
QUESTION:
Given
REAL X
X = ... some value ...
may
IF( X+3.0 .EQ. 3.0 )...
be transformed into
IF( X .EQ. 0.0 )...
by the processor?
In Fortran 2003, 7.1.8.5 Evaluation of relational intrinsic operations
says
"Two relational intrinsic operations are relationally equivalent if
their logical values are equal for all possible values of their
primaries."
On a machine where addition of 3.0 to a small value is not exact, the
logical values for X+3.0==3.0 are not the same as X==0.0 for all
possible values of X, therefore it would seem that this transformation
would not be possible.
Consider a conventional implementation where operations are done in
64-bit and REAL is 32-bit. X+3.0==3.0 is not the same comparison as
either X==0.0 or as in 'X=X+3.0;IF(X ==3.0)', but it is as
'REAL(KIND=KIND(0.0D0)) Y; Y = X+3.0D0; IF (Y == 3.0D0)'. Are we now
forbidding such implementations? The point is that the last paragraph
in the interpretation implies that.
I regret that I didn't think of that example to give in my objection.
I am happy for J3 to interpret my objection as requiring that:
a) The interpretation is changed to say that X+3.0==3.0 cannot
be treated as X==0.0 under all circumstances, but that it may be valid
to do so in some processors under some circumstances (unspecified).
b) No implication that the value X+3.0 must be converted to the
precision of REAL before the comparison is included in the
interpretation. And THAT is the aspect that I really want to hang
on to!
Regards,
Nick Maclaren.
More information about the J3
mailing list