def _log_add(*values):
 x = max(values)
 if (x > (- np.inf)):
  sum_diffs = 0
  for value in values:
   sum_diffs += (2 ** (value - x))
  return (x + np.log2(sum_diffs))
 else:
  return x

def _log_add ( * values ) : x = max ( values ) if ( x > ( - np . inf ) ) : sum_diffs = 0 for value in values : sum_diffs += ( 2 ** ( value - x ) ) return ( x + np . log2 ( sum_diffs ) ) else : return x
adds the logged values .