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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu.org

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2010-10-20 
07:20:18 UTC ---
(In reply to comment #0)
> Results using gfortran 4.5.1:
> 2.18000000000000015987

There are also different philosophies how many digits shall be printed with
list-directed I/O ("fmt=*"). Some compilers do not print the last / the last
few digits to avoid such puzzling results. gfortran prints all to allow
lossless reading of the written data.

However, you can use an explicit format and print fewer significant digits,
which avoids showing the last digits; for instance
 print '(g0.7)', 2.18
shows
2.180000

Regarding the output:

> Results using f77:
> 
> 2.18000000000000000000

That looks like a bug in Absoft's compiler: If the compiler shows that many
digits, it ought to show also the non-zero digits. For comparison, Intel,
PathScale and NAG show the following:
2.18000000000000015987
2.18000000000000016000
2.18000000000000015987

Reply via email to