[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NaNs and netCDF



Organization: RSMAS

Hi Angel,

> I have been working with a graphics package, GMT, that likes to use
> NaN's. What happens when these "values" get XDR'ed out and back in?
> Is this undefined behavior? I'm doing my playing on an Alpha running
> OSF/1 if it matters and usually the first thing these programs do is
> disable SIGFPE.

What happens is not well-defined.  On some systems, there is apparently no
bit pattern that will behave like a NaN when floating-point arithmetic is
used but that will also map under XDR to something that will still behave
like a NaN when un-XDRed.  We had assumed there was always such a bit
pattern and we had tried to use it consistently on each platform for the
netCDF fill-value for floats, but we discovered our assumption was wrong.

The official XDR RFC 1014 says:

   According to IEEE specifications, the "NaN" (not a
   number) is system dependent and should not be used externally.

--Russ