def complex_accuracy(result):
 (re, im, re_acc, im_acc) = result
 if (not im):
  if (not re):
   return INF
  return re_acc
 if (not re):
  return im_acc
 re_size = fastlog(re)
 im_size = fastlog(im)
 absolute_error = max((re_size - re_acc), (im_size - im_acc))
 relative_error = (absolute_error - max(re_size, im_size))
 return (- relative_error)

def complex_accuracy ( result ) : ( re , im , re_acc , im_acc ) = result if ( not im ) : if ( not re ) : return INF return re_acc if ( not re ) : return im_acc re_size = fastlog ( re ) im_size = fastlog ( im ) absolute_error = max ( ( re_size - re_acc ) , ( im_size - im_acc ) ) relative_error = ( absolute_error - max ( re_size , im_size ) ) return ( - relative_error )
returns relative accuracy of a complex number with given accuracies for the real and imaginary parts .