This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

wrong results for SPACING and RRSPACING at compile time


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.

TIA

Dominique


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]