[Bug libfortran/90374] Fortran 2018: Support d0.d, e0.d, es0.d, en0.d, g0.d and ew.d e0 edit descriptors for output

thenlich+gccbug at gmail dot com gcc-bugzilla@gcc.gnu.org
Fri Jan 31 09:03:00 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90374

--- Comment #31 from Thomas Henlich <thenlich+gccbug at gmail dot com> ---
Jerry, I reviewed some of the code in write_float.def:

 478   /* Calculate the format of the exponent field.  */
 479   if (expchar && !(dtp->u.p.g0_no_blanks && e == 0))
 480     {
 481       edigits = 1;
 482       for (i = abs (e); i >= 10; i /= 10)
 483         edigits++;
 484 
...
 499           /* Zero width specified, no leading zeros in exponent  */
 500           if (e > 999 || e < -999)
 501             edigits = 6;
 502           else if (e > 99 || e < -99)
 503             edigits = 5;
 504           else if (e > 9 || e < -9)
 505             edigits = 4;
 506           else
 507             edigits = 3;

To me this seems somewhat redundant.

Wouldn't the following be somewhat shorter, with the same result?

 500           edigits += 2;


More information about the Gcc-bugs mailing list