Hi, The attached patch, which includes test cases, fixes this bug by eliminating the code which used floating point instructions to determine the 'r' value as outlined in the Fortran standard under G formatting. Essentially, the code now examines the d and e values to determine the number of digits before and after the decimal point and whether or not to display the 'E' exponent symbol. Adjustments are made for various corner cases, including when rounding has resulted in a carry. (see PR for details of the trials) This patch is intrusive. It results in a minor performance improvement. It eliminates a bit of code. Regression tested on x86-64. OK for trunk? then later back port to 4.6 after some proving time? Jerry 2011-06-03 Jerry DeLisle PR libgfortran/48906 * write.c (write_d, write_e, write_f, write_en, write_es, write_real, write_real_g0): Eliminate compensating flag for precision adjustment. * io/write_float.def (output_float): Add new comments. Add two new variables lblank and tblank for keeping track of required leading and trailing blanks. Add new code for the FMT_G case to determine digits before and after the decimal point. Update error messages. Reorder some of the existing code, separating portions handling formatting and portions doing the actual output. (CALCULATE_EXP): Delete this macro. (OUTPUT_FLOAT): Delete this macro. (write_float): Eliminate precision compensating flag.