(j3.2006) Question about DIM
Tue Jan 12 18:59:31 EST 2016
> I have not only seen DIM used, I have seen a bug report filed against it.
> user called the function with integer arguments that overflowed when the
> subtraction was done. The function result was negative because of the
> overflow. The user claimed that the Fortran standard required the result
> to be
I had also thought about potential problems with integers. The current
wording seems to just ignore that case.
The same problem arises with non-IEEE reals too. The current wording does
not ignore that case either (see below).
I suspect that we really intend something like
?If X > Y and X - Y is representable by the type and kind of X, the result
is X - Y; otherwise the result is zero.?
Definitely not. Apart from giving the wrong answer, it would also slow down
everyone's integer DIM for the sake of giving a value to an erroneous
calculation. What a waste.
The "current wording" includes 13.8.1p2 which already covers the situation
of an out of range result for any intrinsic function, viz "shall not".
........................Malcolm Cohen, Nihon NAG, Tokyo.
More information about the J3