(j3.2006) G editing to a narrow output field

Tobias Burnus burnus
Wed Aug 17 02:14:34 EDT 2011


Hi Bob,

can you outline why you think that "**    " is the correct output? For 
me, it seems that "******" is correct. We have (R1007) "G w [ . d [ E e 
] ]" and in 10.7.2.1 one has:

"(5) On output, if an exponent exceeds its specified or implied width 
using the E, EN, ES, D, or G edit descriptor, or the number of 
characters produced exceeds the field width, the processor shall fill 
the entire field of width w with asterisks. However, the processor shall 
not produce asterisks if the field width is not exceeded when optional 
characters are omitted."

Robert Corbett wrote:
> Consider the program
>
>      PROGRAM MAIN
>        PRINT '(G6.5)', 1.0
>      END

I see w = 6 - and thus I expect the compiler to "fill the entire field 
of width w with asterisks", which gives 6 asterisks. I might have easily 
missed something, however.

> When I compiled and ran this program the most
> common output was
>
> ******

Same here: 6 compilers produced this output.

> OSS Fortran produces that output.

Well, that's version and compiler dependent; I have one OSS compiler 
which does so, one which doesn't and a third which changed behaviour 
with newer versions.

> I think the output should be
>
> **
> which was produced by one of the implementations
> I tried.  To be clear, there are four blanks after the two asterisks.

Which I get with 3 compilers (+ the old version of a third).

Tobias



More information about the J3 mailing list