Are 3-digit exponents OK?
William Pence
pence at tetra.gsfc.nasa.gov
Mon Feb 22 12:48:45 EST 1999
Patrick L. Nolan wrote:
>
> 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?
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)
More information about the fitsbits
mailing list