On Wed, Aug 19, 2009 at 10:20:38PM -0700, Steve Kargl wrote:
On Wed, Aug 19, 2009 at 11:20:30PM -0500, Krishna Myneni wrote:
I'm compiling a standard numerical algorithm, written in Fortran 77, and
notice an unexpected severe loss of accuracy. The apparent cause appears
to be that the gfortran compiler is ignoring the IMPLICIT statement in
the subroutine.
There are several real literal constants in toms680.f that
are single precision. These values are not magically promoted
to double precision by the use of implict double precision.
Try adding -Wall -Wextra to your compiler command. Does this
report anything?
REMOVE:kargl[14] gfc4x -c -fdump-tree-original -fdefault-real-8 680.f
REMOVE:kargl[15] mv 680.f.003t.original dbl
REMOVE:kargl[16] gfc4x -c -fdump-tree-original 680.f
REMOVE:kargl[17] mv 680.f.003t.original sngl
REMOVE:kargl[18] diff -u sngl dbl > zxc
The contents of zxc are
--- sngl 2009-08-19 22:27:53.000000000 -0700
+++ dbl 2009-08-19 22:27:37.000000000 -0700
@@ -39,8 +39,8 @@
*flag = 0;
xabs = ABS_EXPR <*xi>;
yabs = ABS_EXPR <*yi>;
- x = xabs / 6.30000019073486328125e+0;
- y = yabs / 4.400000095367431640625e+0;
+ x = xabs / 6.29999999999999982236431605997495353221893310547e+0;
+ y = yabs / 4.40000000000000035527136788005009293556213378906e+0;
...