什么是 Fortran 保留字/变量 ACCY?
我试图查看一些非常古老的 FORTRAN 代码,并发现了以下语句:
IF (XKJ.GT.ACCY) THEN
我查看了整个代码,但没有找到“ACCY”的声明。 我假设它是一个内置变量/常量/函数,但无法找到定义。 我用谷歌搜索它并发现了其他具有类似表达式的 FORTRAN 示例(但没有 ACCY 的定义)。
距离我查看 FORTRAN 代码已有 20 年了。 有人知道“ACCY”是什么吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
毫无疑问,它是一个保存用于测量浮点计算的“精度”的变量——由于某些浮点数的不精确表示,它可能会发生漂移。 在 Fortran 中,不必声明变量,除非使用编译器选项(或 IMPLICIT 语句)来打开此功能。 以 AH 和 OZ 开头的变量自动考虑 REAL 变量(IN 是整数)。 有问题的编译器可能会也可能不会将变量的内存清零,因此除非它被分配到某个地方(通常是 COMMON 块),否则它可能为零或某个任意值。
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.
从技术上讲,Fortran 中没有保留/关键字。 尽管将关键字定义为标识符会使事情变得非常混乱。 在我看来,它听起来/看起来像是隐式定义的,这是它的第一次使用,其中 ACCY 将为 0。
定义此代码片段的子例程是否具有 隐式未定义? 如果没有,请打开它并查看编译器是否将 ACCY 标记为未定义。 如果它被标记,您就会知道为什么在其他地方找不到它:)
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 :)