Fortran 77 question 
Author Message
 Fortran 77 question

Perhaps a fortran guru could help me out: What does the following
variable declaration mean?

REAL*8 Q

I suspect it has to do with precision, but I'm not sure.  I can't find
it in my Fortran 77 reference book.  Is this a Fortran 90-ism?

-Jeff
--
Jeffrey N. Woodford      | "All the world's indeed a stage, And we are merely

Physical Chemistry Graduate Student, University of Nebraska - Lincoln



Sat, 25 Oct 1997 03:00:00 GMT  
 Fortran 77 question

Quote:
>Perhaps a Fortran guru could help me out: What does the following
>variable declaration mean?
>REAL*8 Q
>I suspect it has to do with precision, but I'm not sure.  I can't find
>it in my Fortran 77 reference book.  Is this a Fortran 90-ism?
>-Jeff
>--
>Jeffrey N. Woodford      | "All the world's indeed a stage, And we are merely

>Physical Chemistry Graduate Student, University of Nebraska - Lincoln

    Your guess is pretty good, but not quite on target.  *n, where n is a
positive integer, is an extension to the FORTRAN 77 standard (and F90 also).
It was introduced in order to compensate for the lack of multiple kinds of a
particular data type such as REAL or INTEGER in standard FORTRAN 77.  The
notation *n refers to the length of the data type in bytes.  Thus, REAL*8
would declare an 8 byte variable of type REAL.  Typically, this data type
would have 15 decimal digits of precision and an exponent range of
+/- 308.  However, you would need to check your compiler's reference manual
in order to find out the precision and range for certain.

    Standard Fortran 90 has a much better specification, KIND type
parameters.  Thus, F90 is not limited to only two or three kinds of a data
type.  The compiler can support as many different kinds as the designers
want to support.  In F90, your variable declaration would be written:
        REAL (KIND=8) :: Q
However, the KIND type numbers are completely arbitrary, although there are
some defacto standards emerging.

Sincerely,
--

Elmbrook Computer Services      Voice Phone: (414) 783-5869
17130 W. Burleigh Place        
Brookfield, WI   53005          Disclaimer:  These opinions are mine alone.
USA                             They do NOT represent any organization.

"Those who would give up essential Liberty, to purchase a little temporary
    Safety, deserve neither Liberty nor Safety."    -- Benjamin Franklin



Sun, 26 Oct 1997 03:00:00 GMT  
 Fortran 77 question

Quote:
>Perhaps a Fortran guru could help me out: What does the following
>variable declaration mean?

>REAL*8 Q

>I suspect it has to do with precision, but I'm not sure.  I can't find
>it in my Fortran 77 reference book.  Is this a Fortran 90-ism?

This decalration specifies that the variable will be an 8 byte real  
number.  This is not standard FORTRAN 77, but a common extension.

--  
Orville L. Lantto
U.S. Bureau of Mines
Minneapolis, MN



Sun, 26 Oct 1997 03:00:00 GMT  
 Fortran 77 question

Quote:
>Perhaps a Fortran guru could help me out: What does the following
>variable declaration mean?
>REAL*8 Q
>I suspect it has to do with precision, but I'm not sure.  I can't find
>it in my Fortran 77 reference book.  Is this a Fortran 90-ism?

No, it is a very common extension dating back from the time
when single precision reals occupied one 32-bit word, aka 4 bytes,
and double precision twice this space. A lot of Fortran 77 compilers
will support it, but not the newer Fortran 90 ones.

Alles van die beste,

   Jan

** Department of Chemistry * University of Pretoria * South Africa **



Mon, 27 Oct 1997 03:00:00 GMT  
 Fortran 77 question

Quote:
>Perhaps a Fortran guru could help me out: What does the following
>variable declaration mean?
>REAL*8 Q
>I suspect it has to do with precision, but I'm not sure.  I can't find
>it in my Fortran 77 reference book.  Is this a Fortran 90-ism?
>-Jeff
>--
>Jeffrey N. Woodford      | "All the world's indeed a stage, And we are merely

>Physical Chemistry Graduate Student, University of Nebraska - Lincoln

You are right, it has to do about the precision, and  is an equivalent
expression for declaring DOUBLE PRECISION variables. REAL variables
are also found as REAL*4, COMPLEX as COMPLEX*8 and DOUBLE PRECISION
COMPLEX as COMPLEX*16.

The *4 (or*8 or *16) actually shows the number of bytes allocated for
each variable (or array element).

I hope that this helped you a bit.

Athanasios Nenes, Chemical Engineer





Wed, 05 Nov 1997 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Fortran 77 question

2. Fortran 77 question

3. Fortran 77 question

4. Fortran-77 question -- is this legal?

5. A Very Simple Fortran 77 question

6. Fortran 77 simple code question

7. some fortran 77 language question

8. Fortran 77 File I/O Write and Format Question

9. question about negative indices in fortran 77

10. question about negative indices in fortran 77

11. A few basic questions about FORTRAN 77 program

12. Question on FORtran 77 standard

 

 
Powered by phpBB® Forum Software