Fortran77: What does a period in the middle of an eq mean?

In summary, the period in the Fortran 77 code indicates that the number "2" is a float variable rather than an integer. It is important to include the period to avoid potential errors in the program.
  • #1
dimensionless
462
1
I'm trying to comprehend some old Fortran 77 code. I've run across an a line of code that resembles the following:
Code:
R(1)=2.*RL(1)*N(1)
What does the period in the above code mean?
 
Technology news on Phys.org
  • #2
I'm no Fortran expert, but I'll make an educated guess:
I suspect the period is there simply to indicate to the compiler that the "2" is a float variable rather than an integer. Without the period, the compiler might treat the "2" as an integer, which could cause problems elsewhere in the program.
 
  • #3
http://www.ictp.trieste.it/~manuals/programming/sun/fortran/f77rm/1_elements.doc.html has list of fortran symbols. According to them the period(.) is a Radix point, delimiter for logical constants and operators, record fields.
 
Last edited by a moderator:
  • #4
DuncanM has it corretct, 2 is an integer, 2. a float. Also can be written as

R(1)=float(2)*RL(1)*N(1)
 
  • #5
When does the period need to be used?
 
  • #6
If you want R(1) to be a float, you have to use either 2. or float(2) in the expression, if not R(2) probably will be truncated to an integer value. Many of the more recent compilers will overlook this and convert it to a float variable, it is just good programming practice to have it in there or else you may have problems down the road.
 

Related to Fortran77: What does a period in the middle of an eq mean?

1. What is Fortran77?

Fortran77 is a programming language commonly used in scientific and engineering applications. It was released in 1977 and is still used today for its efficient handling of complex mathematical and scientific calculations.

2. What does the period in the middle of an equation mean in Fortran77?

In Fortran77, a period in the middle of an equation is used as a separator between the integer and fractional parts of a numerical value. It is similar to a decimal point in other programming languages.

3. Can a period be used for other purposes in Fortran77 equations?

Yes, a period can also be used as a concatenation operator in Fortran77 equations. This means it can be used to join two strings or character variables together.

4. Is the use of periods in Fortran77 equations mandatory?

No, the use of periods in equations is not mandatory in Fortran77. It is only necessary when separating the integer and fractional parts of a numerical value or when using the concatenation operator.

5. Are there any other symbols or operators that have a special meaning in Fortran77 equations?

Yes, other symbols and operators that have special meanings in Fortran77 equations include the plus sign (+) for addition, minus sign (-) for subtraction, asterisk (*) for multiplication, slash (/) for division, and the caret (^) for exponentiation.

Similar threads

  • Programming and Computer Science
Replies
14
Views
2K
  • Programming and Computer Science
Replies
1
Views
3K
  • Programming and Computer Science
Replies
20
Views
3K
  • Programming and Computer Science
Replies
2
Views
2K
  • Programming and Computer Science
Replies
5
Views
3K
  • Programming and Computer Science
Replies
9
Views
1K
  • Programming and Computer Science
Replies
14
Views
2K
  • Programming and Computer Science
2
Replies
55
Views
4K
  • Programming and Computer Science
Replies
12
Views
2K
  • Programming and Computer Science
Replies
29
Views
2K
Back
Top