我目前正在用Fortran运行一个计算模型。在计算过程中,有时我会得到"NaN","Infinity“和大于双精度的数字(显示为*)。我需要检测到它们。我可以用下面的命令检测"NaN“。
if(isnan(result))then
continue = .false.
else
continue = .true.
endif我不知道如何检测"Infinity“和”*“(大于双精度的数字)。
我该怎么做呢?
发布于 2016-02-26 05:35:13
现在,我使用以下命令解决了星号问题(尽管它可能不是很有效)。谢谢亚历山大·沃格特。
if(isnan(result))then
continue = .false.
elseif(result.gt.1.d20)then
continue = .false.
else
continue = .true.
endif然而,我仍然不能解决“无限”的问题。我尝试过"IEEE“,但是我的编译器不支持。
谢谢
https://stackoverflow.com/questions/35638400
复制相似问题