Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Fortran, what does the .feq. or .fne. mean?

Tags:

fortran

if(a .feq. 5.0_dp) then **** if(a .fne. 5.2_dp) then *** I come across some codes like this. What does the .feq. or .fne. mean? Is it "=" or "\ =" ?

like image 571
高玉强 Avatar asked Jun 24 '21 12:06

高玉强


1 Answers

In Fortran, operators (unary or binary) can take this form, a string of letters (up to 63) with a . at either end. So .feq. and .fne. are operators.

We'll also see operators such as .not., .eq. and so on.

Some operators, such as the two just mentioned, are standard intrinsic operators, some may be non-standard intrinsic operators, and we can even have user defined operators.

.feq. and .fne. are not (Fortran 2018) standard intrinsic operators. They may be non-standard intrinsic operators, but most likely they are user-defined. As they are not standard operators, we cannot say what they do (although as veryreverie comments, we can make reasonable guesses).

You will need to read the documentation for the project (or compiler, for the case of non-standard intrinsic operators), or you can look at the available source code.

How will you find what a user-defined operator does? For .feq. for example you should find an interface block with the OPERATOR(...) syntax:

interface operator (.feq.)
 ...
end interface operator (.feq.)

Inside that interface block you'll find mention of one or more specific functions, much as you would with other generic functions. Check these functions until you find one with the right number of arguments (one for a unary operator, two for a binary) of the right type (first argument matching the one after the .feq. if it's unary; or to the left if it's binary, with the second argument the right). You can then see what this function does.

You may also find your IDE or other tools will tell you how the operator is resolved.

like image 127
francescalus Avatar answered Nov 20 '22 06:11

francescalus