static struct C { double re, im; auto approxEqual(C rhs, double maxRelDiff, double maxAbsDiff) { import mir.math.common: approxEqual; return approxEqual(re, rhs.re, maxRelDiff, maxAbsDiff) && approxEqual(im, rhs.im, maxRelDiff, maxAbsDiff); } } C(1.0, 1.0).shouldApprox == C(1 + 9e-7, 1 - 9e-7);
1.0.shouldApprox == 1 + 9e-7; shouldApprox(1 + 9e-7, 1e-6, 1e-6) == 1;