A low-complexity and high-resolution algorithm for the magnitude approximation of complex numbers