This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/54514] New: g0 output format has too few digits when writing reals
- From: "clivegpage at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 07 Sep 2012 08:58:41 +0000
- Subject: [Bug fortran/54514] New: g0 output format has too few digits when writing reals
- Auto-submitted: auto-generated
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