I have a large old code I am cleaning up and updating. Comparing my new version to the old version I have noticed that the final result, given as a double precision float, is never precisely the same, but tends to differ by a small amount nearing floating point precision. Now, in the original code double precision variables were, seemingly at random, initiated using either real*8 :: variable
or double precision :: variable
. In the new version of the code I want to be more consistent, and ideally I would like to use the more widely recommended KIND system. However for debugging purposes the current version has all variables initiated as real*8 :: variable
.
My question is, is there a guarantee that variables initiated as double precision
or real*8
are treated in exactly the same way. In other words, assuming all other things are equal, should I expect my new code to give the exact same output as the old code? Or is it to be expected that changing all declarations to real*8
changes the rounding error on the level of floating point precision.
Thanks!