From: "Clive Page" <[log in to unmask]>
Sent: Monday, April 29, 2013 7:16 PM
> On 28/04/2013 23:54, John Harper wrote:
>> But why not save a little typing with KIND(0d0)? McCracken's "A Guide to
>> Fortran IV Programming" suggests that 0D0 was a valid way to write
>> double precision zero in Fortran IV; it remained valid in the f66
>> standard and
>> is still valid in f2008.
>
> The disadvantage of that is, of course, that it gets you twice as much precision as the default,
That's not a disadvantage.
> but you don't know for sure what it the default is, so the actual precision is uncertain.
As it depends on the machine, the actual precision is uncertain, whether it's default real or
double.
> What nobody so far has suggested (unless I missed it) is to use a handy Fortran2008 feature:
>
> USE ISO_FORTRAN_ENV
>
> and then declare variables as:
>
> REAL(REAL64) :: whatever
>
> This guarantees you a 64-bit floating-point representation whether that is the default for REAL
> type on that hardware or not. Similarly REAL32 and REAL128 are available, but I suppose the
> latter might not work on all systems.
>
>
> --
> Clive Page
|