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

Tobias Burnus burnus
Fri Aug 19 14:44:35 EDT 2011


On 08/19/2011 06:25 PM, Bill Long wrote:
> Most users understand the words in (b) to mean that you get stars 
> printed if the value cannot be represented by the given format because 
> w is too small.  Perhaps is needs to be worded better.

I concur that most users expect "******" as answer (without ever reading 
the standard). And I concur with Bill that it is not obvious from the 
standard. Though, I can follow the thoughts leading to "**    " and they 
make sense. Thus, a better wording and an official answer to an 
interpretation request would surely help.

> Most implementations have interpreted the right answer to be 6 stars.

Actually, I am not sure whether that's actually true. For the example I 
get "**    " with g77, g95, NAG and PGI. And I get "******" with Intel, 
Sun Studio (sorry, not yet O[racle]SS), Open64, PathScale and Cray. 
Which is merely 4 to 5.

(Caveat: I only tested 9 Fortran 77/90+ compilers and also only a single 
version of them.)

(Until 2011 gfortran also printed "**    " but a patch for an issue [1] 
with "exponent exceeds its specified width" changed somewhat 
accidentally also the output for the discussed case to "******".)

Tobias

[1] The issue was for "WRITE(*,'(G5.5E5)') -10000.0".



More information about the J3 mailing list