rStats.js v1.3.0
    Preparing search index...

    Function erf

    • Error function, erf(x) = 2 / sqrt(pi) * integral from 0 to x of exp(-t^2) dt. Not an R function. R writes it as 2 * pnorm(x * sqrt(2)) - 1, which loses the relative accuracy of small x.

      Parameters

      • x: number

        Argument.

      Returns number

      erf(x).

      erf(0.5);    // 0.5204998778130465
      erf(1e-10); // 1.1283791670955126e-10