Re: maxval,product, etc with mask all false

From: Richard Maine (nospam_at_see.signature)
Date: 05/10/04


Date: 10 May 2004 10:58:07 -0700

Gene Wagenbreth <genew@isi.edu> writes:

> What do routines such as maxval, minval, product, all return when
> a mask is used and all elements of the mask evaluate as false.

All these cases should be documented in any Fortran text. In general,
they return a "reasonable" extrapolation to the zero-size condition,
but the extrapolation is different for different cases. For example,
product is different from maxval/minval. Thus, although I can give
you the specific answers for those 3, I can't answer the "such as"
part of your question in other than the above very general terms. Do
note that having all elements of the mask be zero is just like having
a zero-sized array with no mask - that might help your intuition about
what the "reasonable" extrapolation is likely to be. I do recommend a
textbook for things like this (any textbook).

For those 3 cases:

Maxval returns the largest magnitude negative number and minval
returns the largest positive number that the processor supports for
that kind. The exact definition of "largest" is the subject of a
current interp. In particular, no it doesn't have to equal HUGE(x);
this question involves a fine point of distinction between "model
numbers" and processor-supported values. Also, it may be an
infinity on processors that support such (but if the processor is
going to return an infinity, one would hope that it defaults to
IEEE nonstop mode).

The "obvious" mathematical extrapolation of product to zero size is 1,
which is what you get.

-- 
Richard Maine                       |  Good judgment comes from experience;
email: my first.last at org.domain  |  experience comes from bad judgment.
org: nasa, domain: gov              |        -- Mark Twain