sign(real, 0/0), NaN vs ????????, and trapping

From: Benjamin (snowkid_23_at_yahoo.com)
Date: 01/24/04


Date: 23 Jan 2004 16:18:44 -0800

Hi everyone,

I find it curious that the following

  sign(3.0,0.0/0.0)
returns -3.0

and

  sign(3.0,-0.0/0.0)
returns 3.0

Is 0.0/0.0 "negative"?

I'm using Intel(R) Fortran Compiler for 32-bit applications, Version
7.1 Build 20030307Z on Linux 2.4.18-24.7.xsmp

The main reason I ran into this question is because in some output
from a "complicated program", I very rarely get ???????? as a result
in a summed variable, and I believe that the "quantity being added to
the sum" (sumigrand?) very rarely experiences a division by zero,
despite efforts to accurately constrain it ... once the ???????? has
been added to the sum, the whole sum becomes ????????? and is
useless.

I'm curious, what happened to NaN or Inf representation? Is this a
compiler option?

What is the "correct" way to check for ????????? using if statements?
Here's my take at it:

BIG = a number larger than any possible value r could take in the
program, positive or negative

r = r1/r2
if (abs(r) > BIG) then
  <complain or fix it>
end if

Although i'm not positive that this will always catch "?????????".
Your guidance is appreciated.

Thanks,

-Ben