This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
secnds.f / secnds-1.f failures
- From: Steve Ellcey <sje at cup dot hp dot com>
- To: fortran at gcc dot gnu dot org
- Cc: brooks dot moses at codesourcery dot com
- Date: Fri, 27 Apr 2007 10:53:54 -0700 (PDT)
- Subject: 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