erfcInv function

double erfcInv(
  1. double z
)

Calculates the complementary inverse error function evaluated at z.

Implementation

double erfcInv(double z) {
  if (z <= 0.0) {
    return double.infinity;
  }

  if (z >= 2.0) {
    return double.negativeInfinity;
  }

  double p, q, s;
  if (z > 1) {
    q = 2 - z;
    p = 1 - q;
    s = -1;
  } else {
    p = 1 - z;
    q = z;
    s = 1;
  }

  return _erfInvImpl(p, q, s);
}