http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54514

             Bug #: 54514
           Summary: g0 output format has too few digits when writing reals
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: clivegp...@gmail.com


As far as I can see, writing a real value with g0.d should produce the same
output as f0.d for reasonable values of d, provided the value is in range for
fixed-point rather than exponential output.  This test program shows the
problem:

program gformat
implicit none
real :: pi = 3.1415926535
write(*, '(a,f0.3,a,g0.3,a)') 'f0.3:"', pi, ' g0.3:"', pi, '"'
end

The results give 
f0.3:"3.142" g0.3:"3.14"

The relevant part of the F2008 Standard is 10.7.5.2.2 subsection 4.

Regards
Clive Page

Reply via email to