[Bug fortran/30694] minval/maxval with +/-Inf

burnus at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Mon Feb 5 19:41:00 GMT 2007



------- Comment #5 from burnus at gcc dot gnu dot org  2007-02-05 19:40 -------
As Dick Hendrickson points out in c.l.fortran:
13.7 (the function descriptions) says

"A program is prohibited from invoking an intrinsic procedure under
circumstances where a value to be returned in a subroutine argument
or function result is outside the range of values representable by
objects of the specified type and type parameters, unless the intrinsic
module IEEE ARITHMETIC (section 14) is accessible and there is support
for an infinite or a NaN result, as appropriate."

And IEEE:
http://754r.ucbtest.org/drafts/754r.pdf

"Operations on infinite operands are usually exact and therefore signal no
exceptions."

"Every general-computational and quiet-computational operation involving one or
more input NaNs, none of them signaling, shall signal no exception, except
fusedMultiplyAdd (see 9.2) . For an operation with quiet NaN inputs other than
max and min operations, if a floating-point result is to be delivered, the
result shall be a quiet NaN, which should be one of the input NaNs."

"minNum(x,y) is the canonical floating-point number x if x < y, y if y < x, the
canonicalized floatingpoint number if one operand is a floating-point number
and the other a NaN. Otherwise it is either x or y.
maxNum(x,y) is the canonical floating-point number y if x < y, x if y < x, the
canonicalized floatingpoint number if one operand is a floating-point number
and the other a NaN. Otherwise it is either x or y."


Min/maxval should return (for REAL):
 +INF if there is an INF in the maxval argument array
 -INF if there is a -INF in the minval argument array
 NAN if the argument array only consists of NAN
 -HUGE or HUGE if there the array is zero-dimensional (after masking)
(for the other cases the obvious min/max values of the arguments)

For INTEGERs, we only have:
 -HUGE-1 / +HUGE for a zero-dimensional array (after masking)
(for the other cases the obvious min/max)
as NAN and +/-INF don't exists (cf. PR30512).


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-02-05 19:40:47
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30694



More information about the Gcc-bugs mailing list