Subject: A question about integer valued header keywords

From: davis at space.mit.edu (John E. Davis)
Date: 20 Sep 1996 17:20:37 GMT

What is the precision of an integer in the header?  I have not seen
this question addressed anywhere in the fits documentation.  I am
concerned because the C Fitsio library defines the function `ffpkyj'
which is prototyped

int ffpkyj(fitsfile *fptr, char *keyname, long value, char *comm, int *status);

The problem with this is that `long' is system dependent: sizeof(long) == 4
on a 32 bit system and sizeof(long) == 8 on a 64 bit system.  This
means that I could easily create a fits file on a 64 bit system that
cannot be correctly parsed on a 32 bit system.
-- 
John E. Davis                   Center for Space Research/AXAF Science Center
617-258-8119                    MIT 37-662c, Cambridge, MA 02139
http://space.mit.edu/~davis

---

From: bschlesinger at nssdca.gsfc.nasa.gov (Barry M. Schlesinger)
Date: 24 Sep 1996 09:35 EDT

In article <slrn545kj5.5b8.davis at aluche.mit.edu>, davis at space.mit.edu writes...
>The problem with this is that `long' is system dependent: 
>... I could easily create a fits file on a 64 bit system that

An integer keyword value in the header is the ASCII representation of 
an integer, using hexadecimal characters 30-39. Conversion to an 
integer type for processing is a matter for software, and details of
the process are not specified.  To read the FITS file properly, any
conversion of integer keyword values in a file to integer form must
contain enough bits to express the integers in that file.  The use of
a C long type to contain the value of a keyword is a FITSIO design
decision and not specified by the rules of FITS. 

				Barry Schlesinger
				FITS Support Office
				GSFC/ADF