Print

Print


From: Bill Long
Sent: Thursday, January 12, 2006 9:48 AM
>robin wrote:
 
>>>From: "Richard Wang" <[log in to unmask]>
>>>Sent: Wednesday, January 11, 2006 12:28 PM
 
>>>Thanks .  It works now.  But I thought all you do here are 1) add 
>>>implicit none 2) move function into the program 3) use the word 
>>>'contains'
 
>>In addition, you should use either "DOUBLE PRECISION" instead of REAL*8
>>(which is not portable), or
 
>Well, using DOUBLE PRECISION as a replacement for real*8 is even worse.
>It is likely to be wrong on at least some systems - the very definition of not portable.
 
DOUBLE PRECISION gives double precision on every Fortran,
and by definition is fully portable.
 
    On the other hand, real*8 is not portable.
 
>integer, parameter :: dp = selected_real_kind(1.0d0)
 
>will give a syntax error.  I think you want something like:
 
I meant:
        integer, parameter :: dp = kind(1.0d0)
 
>>real (kind=dp) :: e
 
>with the revised definition of dp, this is the preferred portable method.
 
Certainly is.
 
Another way is to write:
 
integer, parameter :: dp = selected_real_kind(precision(1.0)+1)