(j3.2006) (SC22WG5.5355) [ukfortran] From a colleague

Van Snyder Van.Snyder
Tue Oct 28 13:38:09 EDT 2014

On Tue, 2014-10-28 at 09:54 +0000, N.M. Maclaren wrote:
> And the only good answer to what a logical IF should do if the operand
> involves a NaN is to throw an exception.  The rule that comparisons on
> NaNs always deliver False is every bit as horrible as (say) defining
> an arithmetic IF to take the zero branch on a NaN.  Which would even
> have precedent (Java real=>integer conversion)!

Better than taking the zero branch would be to execute the next
statement, since the other three tests all fail.

Or, make its behavior processor dependent instead of undefined. At least
then one could make minimal changes to the code, such as

  if ( .not. ieee_is_nan ( x ) ) if ( x ) 10, 20, 30
  stop "Why is X a NaN?"

More information about the J3 mailing list