1

I have a short Fortran program that reads data into a table:

  open (1, file="input1.txt", status="old", action="read", form="formatted")
  do line = 1,10000
    read(1,*) in1(line)
  end do
  close(1)
  print *, in1(100)

The file input1.txt has 10000 real numbers in one column, one below the other.
The problem is that within the text file the number under row 100 is 0.401989363445. However, the program above prints: 0.401989371. This is a different value... and it does not seem as a rounding issue... What is going on?

The program is compiled with gfortran, if that makes a difference...

maciek
  • 1,807
  • 2
  • 18
  • 30
  • What is the data type of the variable read (real or double precision or ...). Looks like a typical form of the limitation of a real (32 bit) variable. – albert Jun 14 '20 at 14:37

0 Answers0