double precision g77

I have a program that has been working fine, written in fortran 77 and
compiled using g77 under fedora core 3. I needed to increase the precision
so changed all REAL declarations to DOUBLE PRECISION and changed FUNCTION
to DOUBLE PRECISION FUNCTION. Now my variables are returning NAN values!
Any ideas why this may be?

Many thanks