http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54514
Tobias Burnus <burnus at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |burnus at gcc dot gnu.org --- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-09-07 16:30:49 UTC --- Pre-remark: I haven't checked the standard. My gut feeling is that Clive is right, but on the other hand gfortran and ifort agree on the output. For the following program print '(f0.4," ",g0.4)', 0.123456789, 0.123456789 print '(f0.4," ",g0.4)', 1.23456789, 1.23456789 print '(f0.4," ",g0.4)', 12.3456789, 12.3456789 print '(f0.4," ",g0.4)', 123.456789, 123.456789 print '(f0.4," ",g0.4)', 1234.56789, 1234.56789 print '(f0.4," ",g0.4)', 12345.6789, 12345.6789 end gfortran 4.8 and ifort 12.1 print: .1235 .1235 1.2346 1.235 12.3457 12.35 123.4568 123.5 1234.5679 1235. 12345.6787 .1235E+05 (If it is a bug, is should be in libgfortran/io/write_float.def's output_float_FMT_G_.) I think gfortran and ifort 12.1's output is correct, namely, your example g0.4 doesn't match f0.4 but f0.3: Looking at the table in F2008, 10.7.5.2.2 (for rounding mode == DOWN, i.e. "r = 0", which makes the equations easier), I see Magnitude of Internal Value Equivalent Conversion 1 <= N < 10 F(w-n).(d-1), n('b') where "n is 4 for Gw.d" and "b" is blank. Note the ".(d-1)". Do you now concur that gfortran's/ifort's output is correct? If not, can you explain, using the standard, why you think it should be different?