(j3.2006) G editing to a narrow output field
Bill Long
longb
Wed Aug 17 08:54:43 EDT 2011
On 8/17/11 1:14 AM, Tobias Burnus wrote:
> 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."
The key point here, which does not show up in email font, is that, in
the standard, the "w" in the phrase "entire field of width w" is in
syntax font. For G format, this ties to the line of R1007 noted above.
The value of w is clearly 6 here. That's what appears in the program.
Of the 5 compilers we support, 4 produced ****** and 1 produced ** .
Cheers,
Bill
>
> 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
> _______________________________________________
> J3 mailing list
> J3 at j3-fortran.org
> http://j3-fortran.org/mailman/listinfo/j3
--
Bill Long longb at cray.com
Fortran Technical Support & voice: 651-605-9024
Bioinformatics Software Development fax: 651-605-9142
Cray Inc./Cray Plaza, Suite 210/380 Jackson St./St. Paul, MN 55101
More information about the J3
mailing list