Floating point NaN values as Keywords

Rob Seaman seaman at noao.edu
Tue Aug 12 00:34:14 EDT 1997


Bob Garwood <bgarwood at nrao.edu> writes:

> Pense's cfitsio library will write out "NaN" when given a keyword
> value that is a NaN, at least under Linux and Solaris.

Is this formatted as a string in this case, or do the NaN "digits"
appear as a real valued keyword?  The latter would be illegal.

Any viable solution will likely have to agree with the original FITS
FORTRAN-derived format rules.  The golden "once FITS, always FITS" rule
doesn't actually forbid expanding the definition of a real number by
adding newly allowed values - but this seems like a mighty big change.
Note that restricting (as opposed to "deprecating") previously allowed
values would be forbidden, on the other hand.)

> What does anyone else feel about NaN values and keywords?

Is NaN the only IEEE feature that needs to be considered?  The mapping
between a binary IEEE data representation and an ASCII FITS keyword is
unlikely to ever be perfect.

I see no easy way to support NaN for any keywords that are required to
be type real by the standard (e.g., BSCALE/BZERO).  FITS "user" keywords
are not explicitly typed in general, on the other hand, and an otherwise
real keyword could be retyped as a string to express a NaN.

This presents a bit of a complication for software to handle, but in
practice shouldn't be too big a deal.  Many packages will likely parse
a real/string value correctly already - assuming they can handle NaN's,
that is.  Only applications that need to read that particular keyword
will care in any event.

Rob Seaman
-- 
seaman at noao.edu, http://iraf.noao.edu/~seaman
NOAO, 950 N Cherry Ave, Tucson AZ 85719, 520-318-8248
PGP: 98 8D 8B 49 74 9A 41 88  3A 43 87 54 51 BF 30 4B




More information about the fitsbits mailing list