This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/30694] minval/maxval with +/-Inf
- From: "tkoenig at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 3 Feb 2007 19:28:17 -0000
- Subject: [Bug fortran/30694] minval/maxval with +/-Inf
- References: <bug-30694-10391@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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