- #1
AmenoParallax
- 11
- 0
Hi
I've been struggling with a fortran 77 code that I need for my astrophysics thesis... Since it's quite old, I'm trying to rewrite some features in order to make it more readable, and I'm trying to make it more rigorous by declaring all variables (I'm declaring "implicit none" everywhere), setting all real variable to double precision, and that kind of stuff. No main changes, and most importantly nothing that would alter the result of the computation.
However, something happened, and I got different results with respect to the original version. I spent hours debugging and looking for the exact place where the difference originated, and apparently the problem is due to the declaration of a variable (a double precision array) which is part of a common block.
More precisely, in the original version the variable was declared as:
IMPLICIT REAL*8 (A-H,L,M,O-Z)
COMMON /CMN1/ VA1(4),VA2(4),...
while in my updated version I changed it to:
IMPLICIT NONE
REAL*8 VA1(4),VA2(4),...
COMMON /CMN1/ VA1,VA2
Now, I wouldn't expect that this could change the calculations, but that's what happened... Anybody can explain why?
I don't think the rest of the code and the specific calculations performed are important in solving the issue, and beside that I can't post the code because it's not mine and anyway it's very long.
Any suggestion would be very appreciated. Thanks everybody!
I've been struggling with a fortran 77 code that I need for my astrophysics thesis... Since it's quite old, I'm trying to rewrite some features in order to make it more readable, and I'm trying to make it more rigorous by declaring all variables (I'm declaring "implicit none" everywhere), setting all real variable to double precision, and that kind of stuff. No main changes, and most importantly nothing that would alter the result of the computation.
However, something happened, and I got different results with respect to the original version. I spent hours debugging and looking for the exact place where the difference originated, and apparently the problem is due to the declaration of a variable (a double precision array) which is part of a common block.
More precisely, in the original version the variable was declared as:
IMPLICIT REAL*8 (A-H,L,M,O-Z)
COMMON /CMN1/ VA1(4),VA2(4),...
while in my updated version I changed it to:
IMPLICIT NONE
REAL*8 VA1(4),VA2(4),...
COMMON /CMN1/ VA1,VA2
Now, I wouldn't expect that this could change the calculations, but that's what happened... Anybody can explain why?
I don't think the rest of the code and the specific calculations performed are important in solving the issue, and beside that I can't post the code because it's not mine and anyway it's very long.
Any suggestion would be very appreciated. Thanks everybody!