def _calc_errors(actual, expected):
 base = max(abs(actual), abs(expected))
 abs_err = abs((actual - expected))
 rel_err = ((abs_err / base) if base else float('inf'))
 return (abs_err, rel_err)

def _calc_errors ( actual , expected ) : base = max ( abs ( actual ) , abs ( expected ) ) abs_err = abs ( ( actual - expected ) ) rel_err = ( ( abs_err / base ) if base else float ( 'inf' ) ) return ( abs_err , rel_err )
return the absolute and relative errors between two numbers .