next previous
Up: Definition of the Flexible (FITS)


Subsections

   
6 Data representation

Primary and extension  data shall be represented in one of the  formats described in this section. FITS data shall be interpreted to be a byte stream. Bytes are in order   of decreasing significance. The byte that includes the sign bit  shall be first, and the byte that has the ones bit shall be last.

6.1 Characters

Each character shall be represented by  one byte. A character shall be represented by its 7-bit ASCII (ANSI 1977) code in the low order seven bits in the byte. The high-order bit shall be zero.

6.2 Integers

6.2.1 Eight-bit

Eight-bit integers shall be unsigned binary integers, contained in one byte. 

6.2.2 Sixteen-bit

Sixteen-bit integers shall be twos-complement signed binary  integers, contained in two bytes. 

6.2.3 Thirty-two-bit

Thirty-two-bit integers shall be twos-complement  signed binary integers, contained in four  bytes.

   
6.2.4 Unsigned integers

Unsigned sixteen-bit integers can be represented in FITS files by subtracting 32768 from each value (thus offsetting the values into the range of a signed sixteen-bit integer) before writing them to the FITS file. The BZERO keyword (or the TZEROn keyword in the case of binary table columns with TFORMn = 'I') must also be included in the header with its value set to 32768 so that FITS reading software will add this offset to the raw values in the FITS file, thus restoring them to the original unsigned integer values. Unsigned thirty-two-bit integers can be represented in FITS files in a similar way by applying an offset of 2147483648 (231) to the data values.

6.3 IEEE-754 floating point

Transmission of 32- and 64-bit floating  point data within the FITS format shall use the  ANSI/IEEE-754 standard (IEEE 1985). BITPIX = -32 and BITPIX = -64 signify 32- and 64-bit IEEE floating point  numbers, respectively; the absolute value of BITPIX is  used for computing the sizes of data structures. The full IEEE set of number forms is allowed for FITS interchange, including all special  values. 

The BLANK keyword  should not be used when BITPIX = -32 or  -64; rather, the IEEE NaN should be used to represent an undefined value. Use of  the BSCALE and BZERO keywords  is not recommended.

Appendix .15 has additional details on the IEEE format.


next previous
Up: Definition of the Flexible (FITS)

Copyright ESO 2001