http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46087
Summary: Double precision values, when read in from data file,
include random trailing numbers
Product: gcc
Version: 4.5.1
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: fortran
AssignedTo: [email protected]
ReportedBy: [email protected]
Example code:
program test_dble
real(8) :: a,b
integer :: x,y
open(unit=11,file='testdble.dat',status='old')
read(11,*) a
read(11,*) x
read(11,*) b
read(11,*) y
write(*,'(f22.20)') a
write(*,'(f22.20)') b
print*, a
print*, b
print *, x
print *, y
close(11)
end program test_dble
testdble.dat:
2.18
5
4.2
55
I am converting from using Absoft f77 compiler to the lastest version of
gfortran and when comparing the results, gfortran adds random trailing numbers
onto the end of the double precision numbers. The number SHOULD have all
trailing zeros and no other numbers.
Results using gfortran 4.5.1:
2.18000000000000015987
4.20000000000000017764
2.1800000000000002
4.2000000000000002
5
55
Results using f77:
2.18000000000000000000
4.20000000000000000000
2.18000000000000
4.20000000000000
5
55
The program was not compiiled using any compiler flags.
Thanks.