(j3.2006) G editing to a narrow output field
Robert Corbett
robert.corbett
Thu Aug 18 00:34:07 EDT 2011
On 08/17/11 05:54, Bill Long wrote:
>
>
> 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 ** .
>
I do not think this interpretation holds up to a strict reading of
part of the standard you cited. The number of characters
produced by an F2,4,4(' ') edit descriptor is six. Six does not
exceed the field width of a G6,4 edit descriptor.
The game you propose to play with the letter w runs into a problem
as soon as you reach the first sentence of clause 10.7.2.3.2. The
letter w there looks the same as the one in clause clause 10.7.2.1.
Bob Corbett
> 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
>
More information about the J3
mailing list