------- Comment #21 from fxcoudert at gcc dot gnu dot org  2007-10-17 22:32 
-------
I've been thinking about MINVAL((/NaN,NaN/)), ie minval of an array containing
only NaNs, over and over again, and it's a tough choice. Here's what compilers
currently output for MINVAL and MAXVAL:

Intel: Inf, -Inf
Sun: -NaN, -NaN (yes, that's a negative NaN; don't ask)
g95: Huge, -Huge
gfortran: Huge, -Huge
portland: NaN, -Huge
MIPSpro: Inf, NaN
IBM: Huge, -Huge

So: we can take portland and MIPSpro out, they lack consistency; Intel goes for
infinities, and I don't see how they can justify this in any way, so let's take
them out also. The only two options worth considering are NaN (as Sun does) and
Huge (as Intel and g95 do). Both have pros and cons. The main pro for NaN is
that it ensures that MAXVAL((/x,x/)) is always equal to MAX(x,x), even when x
is a NaN. The main pro for Huge is that it is more consistent with the way NaN
are ignored: for all other purposes, NaNs in the array are handled as if the
mask for that element was .false., so why single out the "only NaNs" case?

Since different compilers already give different answers for this problem, I
guess we can pick the solution we're most comfortable with. Unless people feel
strongly against it, I'd like to go with Huge, because 1. I'm more convinced by
arguments in favour of it, and 2. it's probably easier/faster/more efficient to
implement, because it doesn't need yet another special case.

Opinions welcome. (What a long rant.)


-- 


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

Reply via email to