Fortran double precision scalars get evaluated in single precision
When double precision expressions are assigned to double precision variables, the result has roundoff error at the single-precision level.
E.g. for a variable declared as real*8 a
:
-
a = 1.1
-> roundoff at single-precision level (as expected) -
a = 11
followed bya = a / 10
-> roundoff at double-precision level (as expected) -
a = 1.1d0
-> roundoff at single-precision level (expected roundoff at double-precision level instead)
Some simple test cases to demonstrate each of these scenarios are at my forked repo here.
Edited by Andreas Klöckner