Fortran Does Fortran Use Arithmetic If Statements?

  • Thread starter Thread starter gholamghar
  • Start date Start date
  • Tags Tags
    Fortran Type
AI Thread Summary
The discussion revolves around the use of "If" statements in Fortran, specifically an old style known as "arithmetic if." The user is uncertain about the syntax in a scanned code snippet, questioning whether the statement uses a minus sign or an equals sign. It is clarified that the symbol is indeed a minus sign, indicating a comparison rather than an equality check. The arithmetic if statement operates by evaluating the expression (SPFR - .1) and directing the flow of the program to different labels based on whether the result is negative, zero, or positive. This style is considered outdated in modern Fortran programming.
gholamghar
Messages
23
Reaction score
0
Fortran has this type of "If"?

Hi,
I was reading a code from a thesis, obviously the quality of the scan was not good and I reached to this point in the image below, that the programmer uses "If" statements:

http://i48.tinypic.com/x5z7n.jpg


I am not sure if he uses a "=" sign or a"-" sign for his statement. I mean this is "If (SPFR - .1) 21, 21, 2" or (SPFR = .1) 21, 21, 2"?
do we have such a thing in fortran for an If statement using a minus sign?

Thanks Frotran Masters!
 
Technology news on Phys.org


gholamghar said:
Hi,
I was reading a code from a thesis, obviously the quality of the scan was not good and I reached to this point in the image below, that the programmer uses "If" statements:

http://i48.tinypic.com/x5z7n.jpg


I am not sure if he uses a "=" sign or a"-" sign for his statement. I mean this is "If (SPFR - .1) 21, 21, 2" or (SPFR = .1) 21, 21, 2"?
The symbol is -, not =. This is a very old style in Fortran, and it's called an "arithmetic if" statement.

It's equivalent to these statements:

if (SPFR - .1 < 0) goto 21
if (SPFR - .1 == 0) goto 21
if ((SPFR - .1 > 0) goto 2
gholamghar said:
do we have such a thing in fortran for an If statement using a minus sign?

Thanks Frotran Masters!
That would be Fortran...
 


Mark44 said:
The symbol is -, not =. This is a very old style in Fortran, and it's called an "arithmetic if" statement.

It's equivalent to these statements:

if (SPFR - .1 < 0) goto 21
if (SPFR - .1 == 0) goto 21
if ((SPFR - .1 > 0) goto 2

That would be Fortran...

Thank you so much Mark44, you are awesome! and knowledgeable:)
 
Thread 'Is this public key encryption?'
I've tried to intuit public key encryption but never quite managed. But this seems to wrap it up in a bow. This seems to be a very elegant way of transmitting a message publicly that only the sender and receiver can decipher. Is this how PKE works? No, it cant be. In the above case, the requester knows the target's "secret" key - because they have his ID, and therefore knows his birthdate.

Similar threads

Replies
4
Views
2K
Replies
12
Views
3K
Replies
8
Views
2K
Replies
16
Views
2K
Replies
21
Views
3K
Replies
7
Views
3K
Replies
9
Views
5K
Back
Top