Floating point NaN values as Keywords

Chris Flatters cflatter at nrao.edu
Wed Aug 13 12:11:18 EDT 1997


Barry M. Schlesinger wrote:
> 
> 
> As NOST 100-1.1 puts it, "The value shall be the ASCII text
> representation of a string or constant."   What is the ASCII
> representation of a NaN?

There is no standard ASCII representation of a NaN nor even a
requirement that there be one.  The relevent paragraph of
IEEE-754 states

	If decimal to binary conversion over/underflows,
	the response is as specified in Section 7 [trap
	or +/- infinity depending on mode].  Over/underflow
	and NaNs and infinities encountered during binary
	to decimal conversion should be indicated to the
	user by appropriate strings. NaNs encoded in decimal
	strings are not specified in this standard.
				[Section 5.6]

Summarizing: there a recommendation (not a requirement ---
note the use of "should" rather than "shall") that NaNs be
represented be some "appropriate string" but there is no
specification for the form of that string; if this
recommendation is followed there is no requirement that
such a string should be recognized if encountered when
reading a floating-point number.

In practice, textual representations of NaNs show significant
variability including NaN, -NaN, and QNaN as well as longer
representations.

Without a specific agreement on the format to be used for
indeterminate values of FITS keywords it would not be advisable
to use such values.

	Chris Flatters
	cflatter at nrao.edu




More information about the fitsbits mailing list