[Bug fortran/30694] minval/maxval with +/-Inf
tkoenig at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Sat Feb 3 19:28:00 GMT 2007
------- Comment #2 from tkoenig at gcc dot gnu dot org 2007-02-03 19:28 -------
(In reply to comment #1)
> > We should really be initializing our starting values to +/-Inf, both
> > in the library and the front end.
>
> In principle yes, but we need still return +HUGE or -HUGE (respectively
> -HUGE-1) for arrays with zero elements.
We could always do (assuming the array starts at 1)
if (n <= 0) then
aval = -HUGE_VAL
else
aval = a(1)
do i=2, n
if (a(i) > aval) aval = a(i)
end do
end if
Straightforward for simple cases, could get messy for
masked, multi-dimensional cases.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30694
More information about the Gcc-bugs
mailing list