wrong results for SPACING and RRSPACING at compile time

Steve Kargl sgk@troutmask.apl.washington.edu
Fri Oct 6 00:18:00 GMT 2006


On Sun, Oct 01, 2006 at 04:15:35PM +0200, Dominique Dhumieres wrote:
> The following code
> 
> real x, xd, xu
> x = -3.0*epsilon(x)
> xd = abs(fraction(x))*set_exponent(real(radix(x), kind=kind(x)), 1+digits(x))
> print *, -3.0*epsilon(1.0)-x
> print *, x, spacing(x), spacing(-3.0*epsilon(1.0))
> print *, x, xd, rrspacing(x), rrspacing(-3.0*epsilon(1.0))
> end
> 
> gives
> 
>    0.000000    
>  -3.5762787E-07  2.8421709E-14  5.6843419E-14
>  -3.5762787E-07  1.2582912E+07  1.2582912E+07   6291456.    
> 
> where the last column of the two last lines computed from
> spacing(-3.0*epsilon(1.0)) and rrspacing(-3.0*epsilon(1.0))
> (hence the 'compile time' in the subject) do not match the
> values computed through a variable.
> 

I have a patch that fixes rrspacing.  I need to clean it up a little.
-- 
Steve



More information about the Fortran mailing list