Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

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

  1. Oct 14, 2005 #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 (Text):

    What does the period in the above code mean?
  2. jcsd
  3. Oct 14, 2005 #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.
  4. Oct 14, 2005 #3


    User Avatar
    Gold Member

    http://www.ictp.trieste.it/~manuals/programming/sun/fortran/f77rm/1_elements.doc.html [Broken] 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: May 2, 2017
  5. Oct 14, 2005 #4

    Dr Transport

    User Avatar
    Science Advisor
    Gold Member

    DuncanM has it corretct, 2 is an integer, 2. a float. Also can be written as

  6. Oct 16, 2005 #5
    When does the period need to be used?
  7. Oct 16, 2005 #6

    Dr Transport

    User Avatar
    Science Advisor
    Gold Member

    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) probaly 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.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook