I believe there is a mistake
Let a = minutes to sunrise = T-hr
Let b = minutes of sunup = 1 - a
So the midpoint in my opinion would be
midpoint = 60(a + b/)2
But your definition is
midpoint = 60(b + a/2)
Assuming a 60 minute time step and that that the sunup time is in decimal minutes:
should be
Assuming a 60 minute time step and that that the sunup time is in hours: