Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

comparing logical values

tropfen
새로운 기여자 I
1,046 조회수
Hello,

using IVF 9.0.x the following code was working

logical :: bSt

if (bSt==.true.) then
else
end if

using IVF 10.0 it is not working. Every time the else statement is used.

Is this code incorrect according to fortran standard?

Thanks in advance

Frank

0 포인트
2 응답
Steven_L_Intel1
1,046 조회수
The code is not standard and not correct. == is not defined for logical values, though Intel Fortran supports this as an extension. You should be using .EQV. instead. For much more information, see my article It's only LOGICAL.
0 포인트
Steven_L_Intel1
1,046 조회수
I suppose I should add that your test could be simplified to:

if (bSt) then
...

Typically one does not need to compare against .TRUE. and .FALSE. explicitly. But if you do, use .EQV. or .NEQV..
0 포인트
응답