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]

secnds.f / secnds-1.f failures


I have taken a look at the sporadic secnds.f / secnds-1.f failures
and I have a theory about what the problem is.

In the libgfortran function secnds we have C code containing:

  temp1 = 3600.0 * (GFC_REAL_4)values[4] +
            60.0 * (GFC_REAL_4)values[5] +
                   (GFC_REAL_4)values[6] +
           0.001 * (GFC_REAL_4)values[7];

Because this is C code the constants 3600.0, 60.0, and 0.001 are double
precision constants and the math is all done in double precision
(truncated to single precision at the end).

In the test case secnds.f we have:

      dat1 = 0.001*real (values(8)) + real (values(7)) +
     &        60.0*real (values(6)) + 3600.0* real (values(5))

This is FORTRAN and the the constants 0.001, 60.0, and 3600.0 are single
precision constants and the math is done in single precision.  I think
it is the use of the 0.001 constant and the difference in the precision
between single and double versions that is messing up the test.

We can change the library to do things in single precision or change
the test to do things in double precision and I think that will fix
the test failures.  Any preference on which way to go?

Steve Ellcey
sje@cup.hp.com


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