64-bit integers in FITS

William Pence pence at tetra.gsfc.nasa.gov
Mon Jul 13 16:25:33 EDT 1998


I basically have an open mind about the suggestion to support 64-bit
integers in FITS files, but just wanted to make a couple comments:

- it would be a fairly trivial job to modify the FITS standard to
specify the format for 64-bit integer images and binary table columns. 
Images would have BITPIX = 64, tables would have TFORM = 'K' (or
whatever), and the binary data itself would be written as
twos-complement signed binary integers containing 8 bytes.  Not much
more needs to be said.  There is no restriction on the value of integer
keywords, so they already support 64-bit integers (but most
readers/writers only support 32-bit integers).

- supporting the reading or writing of FITS files containing 64-bit
integer data on 32-bit platforms would likely require a lot of work.  If
the hardware/compiler doesn't support reading and writing 64-bit
integers then interface software like CFITSIO would have to have
software emulation routines to do datatype conversion between 32-bit int
<-> 64-bit int, 64-bit float <-> 64-bit int, etc. and also trap any
overflow conditions.  Presumably there already exist routines to do all
this, written in C, that could be used in CFITSIO.  None the less,
adding support for 64-bit integers in CFITSIO, not to mention all the
other existing FITS readers and writers, would be a big job, and would
make the interface software even more complex than it already is.

- There would still remain the problem that it is not possible in
principle to fully represent 64-bit integers on a 32-bit machines
without possible overflow (when converting to 32-bit integers) or loss
of precision (when converting to double precision floating point).  Thus
one could quite easily write FITS files on 64-bit machines that could
not be read on 32-bit machines.  This would defeat one of the main
purposes of FITS to provide a machine-independent data interchange
format.

____________________________________________________________________
Dr. William Pence                          pence at tetra.gsfc.nasa.gov
NASA/GSFC Code 662         HEASARC         +1-301-286-4599 (voice)     
Greenbelt MD 20771                         +1-301-286-1684 (fax)





More information about the fitsbits mailing list