Subject: Are 3-digit exponents OK?

From: pln at egret1.stanford.edu (Patrick L. Nolan)
Date: 20 Feb 1999 01:57:26 GMT

I'm working on porting cfitsio to a new compiler.  This compiler has
an eccentricity that worries me.  When it prints floating-point numbers,
as in FITS headers, it always uses three digits in the exponent.
For example, it prints "1.3E+001" rather than the familiar "1.3E+01".

I have looked through a recent Users' Guide to FITS, and it doesn't
seem to have anything to say on this issue.  Is this going to break
anyone's FITS reader?
-- 
*   Patrick L. Nolan                                          *
*   W. W. Hansen Experimental Physics Laboratory (HEPL)       * 
*   Stanford University                                       *

---

From: Eric Greisen <egreisen at valen.cv.nrao.edu>
Date: Sun, 21 Feb 1999 11:02:34 -0500 (EST)

> seem to have anything to say on this issue.  Is this going to break

I have reviewed the  new NOST 100-1.2 (11/98) Definition of FITS which
attempts to spell out Fortran formats rather than forcing modern FITS
users to know details of old languages.  The use of 3 digits does not
violate anything in the NOST document.  It does violate the ANSI
Fortran 77 standard which states that Ew.d and Dw.d formats will
produce e.g. E+01 so long as the xponent abs value is < 99 and a form
e.g.+123 (no E) for larger exponents.  There is the little used format
code Ew.dEe whereby you can in principle force the number of exponent
digits so that Ew.dE2 would give the familiar form.

Eric Greisen

---

From: William Pence <pence at tetra.gsfc.nasa.gov>
Date: Mon, 22 Feb 1999 12:48:45 -0500

> seem to have anything to say on this issue.  Is this going to break

I agree with Eric Greisen that the FITS standard allows 3-digit exponents. 
Also, CFITSIO supports 3-digit exponents.  This issue is mainly a potential
problem for applications programmers when writing to E or D columns in FITS
ASCII tables.  For example, trying to write -12.0 to a column with TFORM =
'E8.1', expecting to write the string '-1.2E+01' into the table,  will fail
on platforms that generate 3 digit exponents since the formated value will
be 9 characters long.  Similarly, FITS reading programs which display the
values of any floating point value (not just from ASCII tables) in
exponential format may have problems if they assume the exponent is only 2
digits long.  

-Bill Pence
____________________________________________________________________
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)