gfortran.dg/large_real_kind_1.f90

Brooks Moses bmoses@stanford.edu
Wed Sep 28 08:23:00 GMT 2005


Alan Modra wrote:
> On Tue, Sep 27, 2005 at 06:55:15PM -0700, Steve Kargl wrote:
>>program a
>>   integer, parameter :: knd = 4 ! Set to IBM Extended kind to see problem.
>>   integer b, e, p
>>   real(knd) x,y
>>   b = radix(x)
>>   e = maxexponent(x)
>>   p = digits(x)
>>   x = huge(x)
>>   print*, x
>>   print*, (1._knd - real(b,knd)**(-p)) * real(b,knd)**(e-1) * b
>>end program a
>>
>>The printed values need to be the same.
> 
> I can't see how we can satisfy the relationship above without either
> a) lying about maxexponent, making it one less than actually supported,
> or
[...]

Assuming I've understood the discussion correctly, we're alreadly lying 
about maxexponent -- maxexponent is not the maximum possible exponent 
for a number the processor supports.  It's the maximum exponent for a 
_model number_ -- which means it must be an exponent for which the whole 
range of possible model mantissas is available.

The solution is, thus, to _not_ lie about maxexponent, and have it 
return one less than it currently does -- because the whole range of 
model mantissas is not available for the maximum exponent the processor 
supports, which is what we (I gather) currently return.

- Brooks



More information about the Fortran mailing list