This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/54514] New: g0 output format has too few digits when writing reals


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: unassigned@gcc.gnu.org
        ReportedBy: clivegpage@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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]