What does a period before a number mean in Fortran 77?

  • Topic: Fortran 
  • Thread starter Thread starter dimensionless
  • Start date Start date
  • Tags Tags
    Fortran77 Mean Period
Join the discussion
Registration is free. Start your own thread to ask a follow-up.
5 replies · 6K views
dimensionless
Messages
461
Reaction score
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?
 
Physics news on Phys.org
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.
 
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:
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.