------- Comment #3 from furue at hawaii dot edu  2008-01-31 02:00 -------
Subject: Re:  illegal E format descriptor produces wrong
 output

Hi,

| ------- Comment #2 from kargl at gcc dot gnu dot org  2008-01-31 01:46
-------
| (In reply to comment #0)
| > "E8.0" is an illegal format descriptor,
| 
| Can you cite from the Fortran 95 standard why this is illegal?

Good question :-)  Unfortunately, I don't have a Fortran 95 reference
at hand, and so let me refer to the F77 standard:

  http://www.fortran.com/fortran/F77_std/rjcnf.html


<QUOTE>
13.5.9.2.2 E and D Editing.
The Ew.d, Dw.d, and Ew.dEe edit descriptors indicate that the external
field occupies w positions, the fractional part of which consists of d
digits, unless a scale factor greater than one is in effect, and the
exponent part consists of e digits. The e has no effect on input. 

[. . .]

The scale factor k controls the decimal normalization (13.5.7). If -d
< k <= 0, the output field contains exactly |k| leading zeros and d -
|k| significant digits after the decimal point. If 0 < k < d + 2, the
output field contains exactly k significant digits to the left of the
decimal point and d - k + 1 significant digits to the right of the
decimal point. Other values of k are not permitted.
</QUOTE>

When d = 0, the only possible value for the scaling factor k is 1.
Since "Other values of k are not permitted", you *must* use "1P"
with d = 0, as "1PE8.0".  Q.E.D.

. . . I know this is a rather roundabout logic, and I'm not 100% sure,
actually.  I'm curious.

Now, *if* "E8.0" is legal, what output should be generated for a value
of 1e5 ?  "0.E5" ?

Cheers,
Ryo


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35036

Reply via email to