function erf(x) {
  // erf(-x) = -erf(x);
  const sign = Math.sign(x);
  x = Math.abs(x);

  const a1 = 0.254829592;
  const a2 = -0.284496736;
  const a3 = 1.421413741;
  const a4 = -1.453152027;
  const a5 = 1.061405429;
  const p = 0.3275911;
  const t = 1 / (1 + p * x);
  const y = t * (a1 + t * (a2 + t * (a3 + t * (a4 + t * a5))));
  return sign * (1 - y * Math.exp(-x * x));
}
Approximates the Gauss error function, the probability that a random variable
from the standard normal distribution lies within [-x, x]. Moved from
traceviewer.b.math.erf, based on Abramowitz and Stegun, formula 7.1.26.
@param {number} x
@return {number}