Re: busting sp datatypes
- From: glen herrmannsfeldt <gah@xxxxxxxxxxxxxxxx>
- Date: Mon, 25 Aug 2008 16:05:27 -0800
Ron Ford wrote:
It's been a while since I've turned a program from sp to dp, and I wanted
to check my premises. First, does this
INTEGER, PARAMETER :: DP = KIND(1.0D0) ! define DP
yes, as an appropriate KIND for REAL variables.
give dp for all of the following:
integer(kind=dp), parameter:: trials = 300000
integer (kind=dp), dimension(trials)::F
No, DP (or dp) should not be used for integer
variables and parameters.
real (kind=dp):: harvest, tot, t1, t2, diff, t3, t4
Yes, like that.
(snip)
Third, the strategy whereby I turn *everything* dp seems to be a real
loser. What is a portable way to declare an sp integer?
It would be rare that you would need to change both
INTEGER and REAL variables to double precision at the
same time. The one case I can think of, is with
EQUIVALENCE or COMMON if you needed them to always
be the same size.
KIND(0) will be the appropriate KIND for default
(single precision) integer. (Though integer data is
not usually described as single and double precision.)
There may not be a standard way to generate a double
length integer variable.
-- glen
.
- Follow-Ups:
- Re: busting sp datatypes
- From: wim
- Re: busting sp datatypes
- Prev by Date: Re: Implementing JAVA interfaces in FORTRAN 20xx
- Next by Date: Re: Surprise
- Previous by thread: Re: Most efficient way to write a large matrix to disk
- Next by thread: Re: busting sp datatypes
- Index(es):
Relevant Pages
|