Function scalarApproxRelAndAbs

Check whether the relative error between a and b is smaller than maxEps. If the absolute error is less than maxAbs, the test succeeds however. This is useful when comparing against zero the result of a subtraction.

bool scalarApproxRelAndAbs(T) (
  in T a,
  in T b,
  in T maxAbs = 0.0001,
  in T maxEps = 4 * T.epsilon
)
if (isFloatingPoint!T);