On 4/8/2012 10:28 AM, Richard Maine wrote:
> glen herrmannsfeldt<email@example.com> wrote:
>> Phillip Helbig---undress to reply<firstname.lastname@example.org> wrote:
>>> In article<email@example.com>, "James Van Buskirk" wrote:
>>>>>> DOUBLE PRECISION, PARAMETER :: A = 123456789
>>>>> There are 9 significant digits here, which is more than
>>>>> a single precision quantity supports.
>>>> But A will be defined correctly nonetheless.
>>> Correct to DP or correct to SP? Some compilers make it
>>> correct to DP, but what does the standard guarantee?
>> The integer constant should convert directly to double
>> precision without an intermediate single precision.
> Yes. Single precision is irrelevant here. There is no single precision
> in sight. I would expect this to be done exactly. If you are asking
> about guarantees, though, that's a different matter. The standard has
> pretty much no guarantees relating to the accuracy of floating point
> computations, including the computation involved in converting from
> integer. All the standard does is define the operation to be done. In
> this case, that operation is conversion from integer to double precision
Some of us have been wondering whether real(integervalue, kind(0d0))
should be required for accurate conversion in place of
dble(integervalue), as it seems to be with certain compilers.
Richard seems to be saying we might expect dble() to convert as
accurately, but we have "no guarantee."