strange behaviour of NaN comparison

I was trying to find a way to check whether a float is NaN. Comparing NaN number should always yield false, so not (x == x) should work, but it doesn't. For this program:

import StdEnv

Start = (nan == nan, not (nan == nan))

nan = 0.0/0.0

I get (False, False) as result.

  1. Is there another way to check whether a float is NaN?

  2. This seems to be a compiler bug.