def day_frac(val1, val2, factor=1.0, divisor=1.0):
 (sum12, err12) = two_sum(val1, val2)
 if np.any((factor != 1.0)):
  (sum12, carry) = two_product(sum12, factor)
  carry += (err12 * factor)
  (sum12, err12) = two_sum(sum12, carry)
 if np.any((divisor != 1.0)):
  q1 = (sum12 / divisor)
  (p1, p2) = two_product(q1, divisor)
  (d1, d2) = two_sum(sum12, (- p1))
  d2 += err12
  d2 -= p2
  q2 = ((d1 + d2) / divisor)
  (sum12, err12) = two_sum(q1, q2)
 day = np.round(sum12)
 (extra, frac) = two_sum(sum12, (- day))
 frac += (extra + err12)
 return (day, frac)

def day_frac ( val1 , val2 , factor = 1.0 , divisor = 1.0 ) : ( sum12 , err12 ) = two_sum ( val1 , val2 ) if np . any ( ( factor != 1.0 ) ) : ( sum12 , carry ) = two_product ( sum12 , factor ) carry += ( err12 * factor ) ( sum12 , err12 ) = two_sum ( sum12 , carry ) if np . any ( ( divisor != 1.0 ) ) : q1 = ( sum12 / divisor ) ( p1 , p2 ) = two_product ( q1 , divisor ) ( d1 , d2 ) = two_sum ( sum12 , ( - p1 ) ) d2 += err12 d2 -= p2 q2 = ( ( d1 + d2 ) / divisor ) ( sum12 , err12 ) = two_sum ( q1 , q2 ) day = np . round ( sum12 ) ( extra , frac ) = two_sum ( sum12 , ( - day ) ) frac += ( extra + err12 ) return ( day , frac )
return the sum of val1 and val2 as two float64s .