I am trying to convert a character string to a real number in Fortran (compiled using gfortran), however, I have found that for a couple of the numbers they appear different when written out as strings and when written out as numbers.
For example, I have the following character strings:
'16072013','22082013','17052013'
When I convert these to real numbers I get the following output:
'16072013.0','22082013.0','17052012.0'
The last number has changed (from 17052013 to 17052012) but I cannot understand why as the same process is used to convert all the numbers. I convert using:
REAL :: daymonthyear
CHARACTER(len=20) :: daymonthyear_c
read(daymonthyear_c,'(f9.0)')daymonthyear
Can anyone explain what I am doing wrong and how I can fix the problem?