This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libfortran/47945] New: REAL(8) output conversion error on MinGW32
- From: "thenlich at users dot sourceforge.net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 1 Mar 2011 14:00:44 +0000
- Subject: [Bug libfortran/47945] New: REAL(8) output conversion error on MinGW32
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47945
Summary: REAL(8) output conversion error on MinGW32
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libfortran
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: thenlich@users.sourceforge.net
The last digits of REAL(8) numbers are converted inaccurately on output.
For instance, the output of:
real(8) :: r8
real(16) :: r16
r8 = .14285714285714286d0
r16 = r8
write(*, '(f35.32)') r8
write(*, '(f35.32)') r16
end
is:
0.14285714285714284921875000000000
0.14285714285714284921269268124888
but the expected output is:
0.14285714285714284921269268124888
0.14285714285714284921269268124888
because the internal 64-bit representation of .14285714285714286 is
approximately equal to 0.14285714285714284921269268124888...
Arguably, an output of 0.14285714285714285000000000000000 would equally be
acceptable, because it is the shortest decimal representation of the same
internal value. (This is in fact what the GCC C Compiler on mingw32 does)