First item to compare.
Second item to compare.
Maximum allowable difference relative to rhs. Defaults to 0.5 ^^ 20.
Maximum absolute difference. Defaults to 0.5 ^^ 20.
true if the two items are equal or approximately equal under either criterium.
Complex types works as approxEqual(l.re, r.re) && approxEqual(l.im, r.im)
import mir.internal.utility: isComplexOf; static struct UserComplex(T) { T re, im; } alias _cdouble = UserComplex!double; static assert(isComplexOf!(_cdouble, double)); assert(approxEqual(_cdouble(1.0, 1), _cdouble(1.0000001, 1), 1.0000001)); assert(!approxEqual(_cdouble(100000.0L, 0), _cdouble(100001L, 0)));
assert(approxEqual(1.0, 1.0000001)); assert(approxEqual(1.0f, 1.0000001f)); assert(approxEqual(1.0L, 1.0000001L)); assert(approxEqual(10000000.0, 10000001)); assert(approxEqual(10000000f, 10000001f)); assert(!approxEqual(100000.0L, 100001L));
Computes whether two values are approximately equal, admitting a maximum relative difference, and a maximum absolute difference.