more list-directed i/o problems
Steve Kargl
sgk@troutmask.apl.washington.edu
Sat Apr 17 22:25:00 GMT 2004
Bud, Paul,
I'm continuing my foray into lapack failures. Consider
the following code:
program f
implicit none
integer i, j, n
real a(6,6), b(6,6)
read(*,*) n
do 20 i = 1, n
read(*,*) (a(i,j), j = 1, n)
20 continue
do 30 i = 1, n
read(*,*) (b(i,j), j = 1, n)
30 continue
end
with the following data file:
6
-0.2012E+02 -0.1000E+05 -0.2000E+01 -0.1000E+07 -0.1000E+02 -0.2000E+06
0.6000E-02 0.4000E+01 0.6000E-03 0.2000E+03 0.3000E-02 0.3000E+02
-0.2000E+00 -0.3000E+03 -0.4000E-01 -0.1000E+05 0.0000E+00 0.3000E+04
0.6000E-04 0.4000E-01 0.9000E-05 0.9000E+01 0.3000E-04 0.5000E+00
0.6000E-01 0.5000E+02 0.8000E-02 -0.4000E+04 0.8000E-01 0.0000E+00
0.0000E+00 0.1000E+04 0.7000E+00 -0.2000E+06 0.1300E+02 -0.6123E+05
-0.2000E+02 -0.1000E+05 0.2000E+01 -0.2000E+07 0.1000E+02 -0.1000E+06
0.5000E-02 0.3000E+01 -0.2000E-03 0.4000E+03 -0.1000E-02 0.3000E+02
0.0000E+00 -0.1000E+03 -0.8000E-01 0.2000E+05 -0.4000E+00 0.0000E+00
0.5000E-04 0.3000E-01 0.2000E-05 0.4000E+01 0.2000E-04 0.1000E+00
0.4000E-01 0.3000E+02 -0.1000E-02 0.3000E+04 -0.1000E-01 0.6000E+03
-0.1000E+01 0.0000E+00 0.4000E+00 -0.1000E+06 0.4000E+01 0.2000E+05
gfortran dies with
kargl[224] ./f < f.dat
At line 14 of file f.f
Fortran runtime error: Bad real number in item 1 of list input
The bad real number is the -0.2000E+02 in the second group of (6,6)
numbers. The problem is related to the negative sign. If I change
the first number to 0.2000E+02, then the program runs fine.
--
Steve
More information about the Fortran
mailing list