> Date: Tue, 14 Nov 2000 18:00:12 +0100
> From: Pascal Richard <[log in to unmask]>
> on a compiler where the default KIND for reals is 32 bits, the definition
>
> integer, parameter :: R64=selected_real_kind(13)
> real(kind=R64), parameter :: OneOnThree = 0.333333333333333
>
> can consider the litteral constant 0.333333333333333 as a 32 bits real
> and assign 0.33333333 to OneOnThree, creating a precision lost.
Not quite. The value 0.333333972518489_R64 is stored.
A single-precsion constant is used, extended by binary zeros to
a double word (or whatever corresponds to R64).
> the right notation is :
>
> integer, parameter :: R64=selected_real_kind(13)
> real(kind=R64), parameter :: OneOnThree = 0.333333333333333_R64
Indeed!
> Pascal RICHARD
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|