This is the mail archive of the mailing list for the GCC 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]

Re: [testsuite gfortran] partial fix for secnds*.f

Dominique Dhumieres wrote:
This is the standard-required behavior for DATE_AND_TIME. SECNDS is nonstandard, and the G77 manual doesn't document its behavior at midnight.

From libgfortran/intrinsics/date_and_time.c, I get
So, unless the C function 'fmod' is YAMIIOM (yet another math illiterate
implementation of modulo), I don't understand how the tests can return

Strange, indeed. Though it could possibly be rounding very slightly or something....

Probably we want to emulate whatever g77 did,

This is not the case: the following codelet

print *, secnds(86400.0), secnds(86401.0)


-27613. -27614.

with g77 ( -27581.053 -27582.053 with g95, slightly later!-) and

58799.91 58798.91

with gfortran, i.e., gfortran fold the result in [0.0,86400.0[ (or]?).

Hmm. And it looks like this isn't just weirdness for values equal to 86400 or greater in g77; it does the same thing for secnds(86300.0) too.

A further hmm is that g77 actually documents things this way -- the return value is explicitly the time since midnight, minus the reference time, with no mention of wrapping. The gfortran documentation doesn't actually document what happens when a reference time is given.

This "reference time" argument seems to be relatively worthless as defined in g77, really; I wonder how it was defined in the compiler g77 got it from.

I don't really like using magic numbers like this. How about defining

tol = 2.0 * (24.0 * 3600.0 - nearest (24.0 * 3600.0, -1.0))

at the beginning, and using that? Though, actually, there's a better phrasing of the same idea:

tol = 2.0 * spacing (24.0 * 3600.0)

Does that seem to work as well?

Just a coding style question: is F90 syntax allowed in *.f codes? or are they supposed to be compiled with a f77 compiler?

F90 syntax is allowed; the only distinction is free-form versus fixed-form.

- Brooks

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