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

--- Comment #26 from anlauf at gcc dot gnu.org ---
(In reply to Jerry DeLisle from comment #24)
> Currently gfortran does the following:
> 
> character(20) :: fmt
> character(9) :: buffer
> fmt = "(1a1,d0.2,1a1)"
> write(buffer,fmt) ">", 3.0, "<"
>  print *, buffer
> fmt = "(1a1,e0.2,1a1)"
> write(buffer,fmt) ">", 3.0, "<"
>  print *, buffer
> end
> 
> 
> $ gfc question.f90 
> $ ./a.out 
>  >0.30D+1<
>  >0.30E+1<
> 
> Why not:
> 
> $ ./a.out 
>  >3.00D+0<
>  >3.00E+0<

It seems the Fortran standard changed here between F2018 and F2023.

F2018, Table 13.1:

Ew.d       |exp| ≤ 99    E±z1z2 or ±0z1 z2
      99 < |exp| ≤ 999   ±z1 z2z3

So Intel implements this.

========

F2023, Table 13.1:

Ew.d E0 or E0.d    any   E±z1 z2 . . . zs

with footnote:

(1) where each z is a digit, and s is the minimum number of digits required to
represent the exponent. A plus sign is produced if the exponent value is zero.

========

Reply via email to