Is this expected?

I experimented a little with this, and a workaround for the .eqv. problem is to define the logical variables

   logical :: qx, qy
   ...
   qx = x <= 0.0
   qy = y <= 0.0

and then use those variables in the various write statements and expressions. This seems to work correctly, even with aggressive compiler options.

$ gfortran --version -ffast-math eqv.f90 && a.out
GNU Fortran (Fink gcc11 11.3.0-1) 11.3.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

              NaN              NaN               NaN                                                                                   
 F F F F
 F F T F
 Right.

The first line shows the results of the original expressions (which is incorrect), while the remaining (correct) lines are with the logical variables.

1 Like