abs method
Return the absolute value of this complex number.
Returns NaN
if either real or imaginary part is NaN
and double.INFINITY
if neither part is NaN
,
but at least one part is infinite.
Implementation
@override
double abs() {
if (isNaN) return double.nan;
if (isInfinite) return double.infinity;
var x = real.abs();
var y = imaginary.abs();
if (x > y) {
final z = x;
x = y;
y = z;
}
if (x == 0.0) return y;
final q = x / y;
return y * math.sqrt(1 + q * q);
}