tags:

views:

186

answers:

3

I was trying to look through some very old FORTRAN code and came across the following statement:

IF (XKJ.GT.ACCY) THEN

I looked through the entire code and didn't find a declaration for 'ACCY'. I am assuming it is a built-in variable/constant/function, but wasn't able to find the definition. I 'googled' it and came across other FORTRAN samples with similar expressions (but no definition of ACCY).

It's been 20 years since I have looked at FORTRAN code. Anyone have any idea what 'ACCY' is?

+3  A: 

Technically, there are no reserved/keywords in Fortran. though defining a keyword as an identifier makes things very confusing. It sounds/looks to me like its being implicity being defined and this is its first use in which ACCY would be 0.

Does the subroutine in which this snippet of code is defined have IMPLICIT NONE defined? if not, turn it on and see if the compiler flags ACCY as not being defined. If its flagged you will know why you couldnt find it elswhere :)

MikeJ
+5  A: 

It's undoubtedly a variable holding an "accuracy" used to measure floating point computations -- which can drift due to the inexact representation of some floating point numbers. In Fortran variables don't have to be declared unless you use a compiler option (or IMPLICIT statement) to turn this feature on. Variables that start with A-H and O-Z are automatically consider REAL variables (I-N are integers). The compiler in question may or may not zero out the memory for the variable so unless it's assigned somewhere -- typically a COMMON block -- it may be zero or some arbitrary value.

tvanfosson
That's exactly what it was. I COMMON block that I didn't have the source code for was defining the variable. Thanks for pointing me in the right direction.
Tim Cochran
A: 

What compiler were you using? Some compilers would have given you a better diagnostic.