isClose method
Return true if the values Complex and other are close to each other
and false otherwise.
Whether or not two values are considered close is determined according
to given absolute and relative tolerances.
relTol is the relative tolerance – it is the maximum allowed difference
between Complex and other, relative to
the larger absolute value of Complex and other. For
example, to set a tolerance of 5%, pass relTol:0.05.
The default tolerance
is 1e-09, which assures that the two values are the same within
about 9 decimal digits. relTol must be greater than zero
absTotal is the minimum absolute tolerance – useful for
comparisons near zero absTotal must be at least zero.
Implementation
@override
bool isClose(Complex other, {double relTol = 1e-09, double absTotal = 0.0}) {
return abs(this - other) <=
math.max(relTol * math.max(abs(this), abs(other)), absTotal);
}