From: "Bill Long" <[log in to unmask]>
Sent: Friday, April 26, 2013 10:45 PM
> On 4/26/13 2:45 AM, Phillip Helbig wrote:
>>> What is the modern recommended way of working with double precision numbers?
>>
>> There is a huge amount of discussion on this, both here and in
>> comp.lang.fortran, as well as various books.
>>
>> Why not just use DOUBLE PRECISION?
>>
>> It depends on what you want, of course. If you want to specify an exact
>> minimum precision and handle the cases when it is not available then,
>> yes, there are tools for this, such as:
>>
>>> integer, parameter :: dp = selected_real_kind(p=precision(0.0)+1)
>>>
>>> which on all computers that I tried gives double precision.
>>
>>
>> But if you want double precision, just write DOUBLE PRECISION.
>
> The problem is that, in terms of precision, DOUBLE PRECISION is
> meaningless.
It isn't really meaningless.
It means a precision that's greater than default (or single) precision.
> It might be 64-bit IEEE, or it might be 128-bit IEEE. Or
> possibly something else. That's why the mechanisms for specifying
> precision were added. In fact, I would say that a Fortran programming
> "best practice" is to NEVER declare something DOUBLE PRECISION. At least
> for new codes that are not tied to last-century libraries that have
> DOUBLE PRECISION argument or function result declarations.
|