[J3] Question on overflow and run-time detection of infinity?

Clune, Thomas L. (GSFC-6101) thomas.l.clune at nasa.gov
Tue Nov 27 08:51:36 EST 2018


Thanks Malcolm.

I will indeed try to get things fixed in gfortran.      I wanted to make certain I was not being unreasonable before pushing the issue further.

If the patch is trivial, I may attempt it myself, otherwise it will be  a bug report.

Cheers,

- Tom


On Nov 26, 2018, at 9:13 PM, Malcolm Cohen via J3 <j3 at mailman.j3-fortran.org<mailto:j3 at mailman.j3-fortran.org>> wrote:

Hi Tom,

I think that the clear intention with IEEE_VALUE is that it does not *compute from finite operands* the values it is returning, and therefore, with the possible exception of a signalling NaN, it should not raise any signal at all: not OVERFLOW, not INVALID, not UNDERFLOW, and not INEXACT.

You can see this by the wording which allows IEEE_VALUE(x,IEEE_SIGNALING_NAN) to raise INVALID and have the signalling NaN converted to a quiet NaN.

In other words, the discussion of the -fpe_trap option or whatever is beside the point.  The point being that it’s not supposed to raise a signal anyway.

That said, it is not immediately clear from the text of IEEE_VALUE itself that it’s not *allowed* to perform useless calculations that raise all kinds of signals.  Given that all the other procedures specify the entire set of exceptions that can be raised and when, and IEEE_VALUE itself does specify an exception in a particular case, it would be a very strained interpretation.  But I don’t immediately see any text that explicitly rules it out (if anyone else knows of such text please let me know!).

Such a strained, some would even go so far as to say perverse, interpretation would mean that IEEE_VALUE(x,IEEE_NEGATIVE_ZERO) would be allowed to raise INVALID and OVERFLOW and UNDERFLOW and INEXACT all at once, perhaps the implementor decides to populate the whole table of values on the first call, or even on every call.

Given that this sounds useless and stupid, I find it hard to believe it’s what we intended.  An interpretation request to resolve the issue is probably a good idea.

Of course you could (also) complain to the gfortran guys that although raising OVERFLOW here might be technically acceptable by a strict interpretation of the words, it seems unlikely it’s what those words were intended to say, and more to the point, raising the exception is definitely Not Required, and obviously(?) Not Useful.  They should just have a table of values and return the value!  And they should not wait for a corrigendum to be published because that just takes too long.

Or seeing as how it’s open source you could just fix their IEEE_VALUE routine(s) yourself…

Cheers,
--
..............Malcolm Cohen, NAG Oxford/Tokyo.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20181127/64e333ef/attachment.html>


More information about the J3 mailing list