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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |burnus at gcc dot gnu.org
         Resolution|---                         |INVALID

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Closed as INVALID - if you disagree, reopen with stating a good reason.


The output looks okay to me - and I get the same result with other compilers.

You really shouldn't use the P edit descriptor - it makes everything very
complicated and can lead to surprising results. See Fortran 2008's "10.8.5 P
editing" at http://gcc.gnu.org/wiki/GFortranStandards for the interpretation of
the "P".

"The kP edit descriptor temporarily changes (9.5.2) the scale factor for the
connection to k. The scale factor affects the editing done by the F, E, EN, ES,
D, and G edit descriptors for numeric quantities."


Your format uses:
  1pe10.2

If one applies the following on "100.0" (or "0.10e03"), one obtains "1.00e02":

"On output, with E and D editing, the effect is that the signicand (R414) part
of the quantity to be produced is multiplied by 10k and the exponent is reduced
by k."

For the next item (after the "1pe10.2,1x,") in the same WRITE statement, the
format uses the following edit descriptor:
   f8.2
which is equivalent to
   1pf8.2
as the 1P edit descriptor is still active.

The standard now states the following for the k P F edit descriptor:

"On output, with F output editing, the effect is that the externally
represented number equals the internally represented number multiplied by
10**k; the internal value is converted using the I/O rounding mode and then the
scale factor is applied to the converted decimal value."

Thus, you have "100.0" multiplied by 10**1 = 10, which gives "1000.0". That is
also the result you get.

Reply via email to