What Does This Fortran Statement Do?

  • Thread starter dibloff
  • Start date
In summary, the conversation discusses a Fortran statement that is being converted to VB. The IF statement checks for a condition and has three possible outcomes represented by labels 16, 16, and 17. This type of IF statement is called an arithmetic IF statement and was used in early versions of Fortran. It is now rarely used since the introduction of the IF/THEN/ELSE statement. The example provided in the conversation is equivalent to an IF statement with a comparison operator and an ENDIF statement. The conversation concludes with the understanding and appreciation of the Fortran statement.
  • #1
dibloff
10
0
Hi Community!

I'm wondering what this Fortran statement does, per your opinion:

IF(PMAX-P(I))16,16,17
16 PMAX=P(I)
ICAMAX=I
17 CONTINUE

This was done in Fortran 77. I'm trying to convert it to VB, and I Google-d it, researched it, but it's hard to understand. The IF statement looks for PMAX-P(I) to be TRUE, which makes no sense cause the variable type for PMAX & P(I) are both REAL, therefore their difference will be REAL too, and not LOGICAL. Then there is this 16,16,17… I guess it’s checking if PMAX-P(I) is zero, if it not zero, then it’ll execute label 16, which will force their difference to be zero.
Does anybody know what 16,16,17 suppose to do? Maybe there is an hidden option for IF statement like this: IF(blablabla)>0,<0,0

Thank you

A.
 
Technology news on Phys.org
  • #2


This would be hard to find with google unless you knew it is called an arithmetic if statement. http://www-linac.kek.jp/cont/langinfo/web/Fortran/docs/lrm/lrm0128.htm

This was the only type of IF statement in early versions of Fortran, but after the IF/THEN/ ELSE statement was added, it is hardly ever used.

Your example means the same as

IF (PMAX .LE. P(I)) THEN
PMAX=P(I)
ICAMAX=I
ENDIF
 
  • #3


Alephzero

Thanks a lot. This makes completely perfect sense.

A.
 

Related to What Does This Fortran Statement Do?

1. What does the equation "If (pmax-p(i))16,16,17" mean?

This equation is a mathematical expression that is used to calculate the difference between two values, pmax and p(i), multiplied by the numbers 16, 16, and 17.

2. How do you solve the equation "If (pmax-p(i))16,16,17"?

To solve this equation, you would first subtract p(i) from pmax. Then, you would multiply that difference by 16, and then multiply it by 17. The final result will be the solution to the equation.

3. What is the significance of using the numbers 16, 16, and 17 in the equation "If (pmax-p(i))16,16,17"?

The numbers 16, 16, and 17 are simply factors that are being applied to the difference between pmax and p(i). They may represent specific values or variables in a larger problem or experiment.

4. Can the equation "If (pmax-p(i))16,16,17" be simplified or rewritten in a different form?

Yes, depending on the context and purpose, this equation may be simplified or rewritten in a different form. However, without further information, it is not possible to determine the most appropriate form for this equation.

5. How is the equation "If (pmax-p(i))16,16,17" applied in scientific research?

This equation may be used in a variety of ways in scientific research, depending on the field and specific experiment. It could be used to calculate differences between measurements, determine rates of change, or analyze patterns in data. The specific application would depend on the context in which the equation is being used.

Similar threads

  • Programming and Computer Science
Replies
4
Views
1K
  • Programming and Computer Science
Replies
9
Views
1K
  • Programming and Computer Science
Replies
6
Views
2K
  • Programming and Computer Science
Replies
4
Views
15K
  • Programming and Computer Science
Replies
2
Views
1K
  • Programming and Computer Science
Replies
11
Views
14K
  • Programming and Computer Science
Replies
18
Views
16K
  • Programming and Computer Science
Replies
3
Views
2K
  • Programming and Computer Science
Replies
3
Views
1K
  • Computing and Technology
Replies
3
Views
2K
Back
Top