abs function
the distance between the origin (0,0) and the complex in the complex plane
returns Infinity if one of the complex values if Infinity
returns NaN if one of the complex values if NaN.
Implementation
double abs(Complex complex) {
return math.sqrt(math.pow(complex.real, 2) + math.pow(complex.imaginary, 2));
}