﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
734	Important: Corrected bug in dateclock.F (routine caldate)	arango		"Corrected a bug in the routine '''caldate''' (module '''dateclock.F''') when computing the fractional '''hour''' and fractional '''minutes'''.  This only affects an application that uses the '''DIURNAL_SRFLUX''', which modulate the shortwave radiation '''SRFLX''' (read and interpolated elsewhere) by the local
diurnal cycle (a function of longitude, latitude, and day-of-year) using the Albedo equations.

We need to call caldate for the Albedo equations:
 {{{
     CALL caldate (tdays(ng), yd_r8=yday, h_r8=hour)
}}}
Here the fractional '''hour''' of the date was not computed correctly.

I was tracking why ROMS was not producing the same solution as before the change to the !Calendar/Date/Clock update (src:ticket:724).  It turns out that difference in the solution is due to round-off.

The new routines compute and more exact date variables because we now use the floating-point rounding function with a Fuzzy or Tolerant Floor     function:
 {{{
      seconds=DayFraction*86400.0_r8
      CT=3.0_r8*EPSILON(seconds)             ! comparison tolerance
      seconds=ROUND(seconds, CT)             ! tolerant round function
}}}
The '''ROUND''' function eliminates round-off by improving the floating point representation in the computer.

So if you are using the option '''DIURNAL_SRFLUX''' the solutions are not reproducible because of the round-off.  The solutions with the new code are more precise!"	bug	closed	major	Release ROMS/TOMS 3.7	Nonlinear	3.7	Fixed		
