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 libfortran/47945] New: REAL(8) output conversion error on MinGW32


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)


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