On Thu, 25 Apr 2013, Neil Carlson wrote:
> Date: Thu, 25 Apr 2013 14:29:56 -0600
> From: Neil Carlson <[log in to unmask]>
> Reply-To: Fortran 90 List <[log in to unmask]>
> To: [log in to unmask]
> Subject: Re: How to select double precision
>
> Hi Ondrej,
>
> I suspect that what you mean by 'double precision' is 64-bit IEEE float,
> which happens to be double precision in every Fortran implementation
> I've ever used, but that not necessarily the case.
>
>
> On Thu, Apr 25, 2013 at 2:08 PM, Ondřej Čertík <[log in to unmask]>wrote:
>
>>
>> integer, parameter :: dp = selected_real_kind(p=15)
>>
>
> This is what I've done for years (but called it r8). Lately, though, I've
> started
> using the kind parameters from iso_fortran_env (2008):
>
> use,intrinsic :: iso_fortran_env, only: r8 => real64
>
> -Neil
>
I don't do it that way because two compilers I use a lot do not have
real64 and two do. As none of them claims to have all of f2003 I'm
certainly not surprised that two of them don't have a feature new in
f2008. (I usually test my programs with all 4 compilers - that catches
many of my bugs and a few of theirs.)
Double precision is not obsolescent - Metcalf et al. don't say it is.
They merely deprecate it, saying it might be removed from a future
Fortran standard because there are other ways of getting the same
effect. Even then you would probably find that vendors continue to
implement it because they hate big users saying "This used to work
with your compiler but now it won't, so we'll change to Brand X."
I agree with those who prefer selected_real_kind(p=15) or the briefer
equivalent selected_real_kind(15). I have used the r=something option
e.g. selected_real_kind(r=4000) only when testing whether compilers
could print an enormous value in F0.0 format. (One couldn't; I have
reported the problem to them.)
-- John Harper, School of Mathematics Statistics and Operations Research
Victoria University, PO Box 600, Wellington 6140, New Zealand
e-mail [log in to unmask] phone (+64)(4)463 5276 fax (+64)(4)463 5045
|