At 03:22 PM 6/25/98 +0200, Thorsten Ohl wrote:
>> The point is that you cannot assume that P1 always differs
>> from P2 (and not only for a small minority of compilers...)
>
>From Chapter Four:
>
> The decimal precision of the double precision real approximation
> method shall be greater than that of the default real method.
>
>Therefore, there _must_ be _some_ P1 and P2 such that REAL(KIND=P1)
>and REAL(KIND=P2) differ. I also think that the definition of
>EQUIVALENCE implies that DOUBLE PRECISION numbers occupy twice as much.
>storage as REALs or INTEGERs.
>
>Isn't the following portable?
>
> module kinds
> integer, parameter, public :: &
> P1 = kind (1.0), &
> P2 = selected_real_kind (precision (1.0) + 1)
> end module kinds
>
>If not, I'd like to hear why not!
Yes, that should be portable to all compilers. but, it doesn't necessarily
do what the original question asked for.
(Might also be better to use
P2 = kind(1.0D0)
in case there is ever a machine that supports 32, 48, and 64 bit modes.
I'm not sure the standard prohibits a precision between "single" and
"double".)
But the original question wanted to use 6 and 13 digits of precision
and he couldn't do this in a way that allowed him to use the kind
number as a generic discriminator. If he wants two different
precisions then your method is fine. If he actually has 6 digit and 13
digit analog data then he's out of luck with generic functions.
Dick Hendrickson
>
>--
>Thorsten Ohl, Physics Department, TU Darmstadt -- [log in to unmask]
>http://crunch.ikp.physik.tu-darmstadt.de/~ohl/ [<=== PGP public key here]
>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|