This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]