No reason in particular I would say. It is an old code and perhaps I
was not aware that double precision random number was available.
Anyway, thanks for pointing this out. I'll updated it.
Cheers,
AA
On Wed, Nov 16, 2011 at 4:06 PM, W.J. Metzger <[log in to unmask]> wrote:
> Why do you convert a single-precision random number to double precision
> when you can generate a double-precision random number directly?
>
> !---------------------------------------------!
> function drand()
> implicit none
> real(8) :: r
> call random_number(r)
> drand = r
> end function drand
> !---------------------------------------------!
>
> Cheers, Wes
>
> On Wed, 16 Nov 2011, Adriano Amaricci wrote:
>
>> !---------------------------------------------!
>> function drand()
>> implicit none
>> real(8) :: drand
>> real(4) :: r
>> call random_number(r)
>> drand=dble(r)
>> end function drand
>> !---------------------------------------------!
>
|