I'm currently busy refactoring a script i got from somebody and a really strange thing happens. At a certain point in the code, a simple calculation is made. In order to check if the result and input is the same, I wrote the following in both versions:
If I look at the output files for both runs, the value of phix is exactly the same for all px. The value of Hx is also exactly the same for all px, except for px = 6. In the original version, Hx(6,1) = 0.4861756328364343, and in the new version, Hx(6,1) = 0.4861756328364341.
If I change the calculation of Hx to
the samething occurs, but for px = 7, with Hx(7,1) = 0.4220554448918039 in the original version and Hx(7,1) = 0.4220554448918036 in the new version.
Does somebody know what could be the reason of this?
Code:
open(310,file='testFile.txt',status='new')
write(310,*)'Begin output phi'
do px=1,Nx
write(310,*) phix(px)
end do
do px=1,Nx
do py=1,Ny
Hx(px,py)=2.0D0*exp(-1.0D0*phix(px))
end do
end do
write(310,*)'Begin output Hx'
do px=1,Nx
write(310,*) Hx(px,1)
end do
close(310)
If I look at the output files for both runs, the value of phix is exactly the same for all px. The value of Hx is also exactly the same for all px, except for px = 6. In the original version, Hx(6,1) = 0.4861756328364343, and in the new version, Hx(6,1) = 0.4861756328364341.
If I change the calculation of Hx to
Code:
Hx(px,py)=2.0D0*exp(-1.1D0*phix(px))
Does somebody know what could be the reason of this?