lib/gaussian.js
function(x) {
    if (x >= 2) { return -100; }
    if (x <= 0) { return 100; }

    var xx = (x < 1) ? x : 2 - x;
    var t = Math.sqrt(-2 * Math.log(xx / 2));

    var r = -0.70711 * ((2.30753 + t * 0.27061) /
            (1 + t * (0.99229 + t * 0.04481)) - t);

    for (var j = 0; j < 2; j++) {
      var err = erfc(r) - xx;
      r += err / (1.12837916709551257 * Math.exp(-(r * r)) - r * err);
    }

    return (x < 1) ? r : -r;
  }
function(x) {
    if (x >= 2) { return -100; }
    if (x <= 0) { return 100; }

    var xx = (x < 1) ? x : 2 - x;
    var t = Math.sqrt(-2 * Math.log(xx / 2));

    var r = -0.70711 * ((2.30753 + t * 0.27061) /
            (1 + t * (0.99229 + t * 0.04481)) - t);

    for (var j = 0; j < 2; j++) {
      var err = erfc(r) - xx;
      r += err / (1.12837916709551257 * Math.exp(-(r * r)) - r * err);
    }

    return (x < 1) ? r : -r;
  }
function ( x ) { if ( x >= 2 ) { return - 100 ; } if ( x <= 0 ) { return 100 ; } var xx = ( x < 1 ) ? x : 2 - x ; var t = Math . sqrt ( - 2 * Math . log ( xx / 2 ) ) ; var r = - 0.70711 * ( ( 2.30753 + t * 0.27061 ) / ( 1 + t * ( 0.99229 + t * 0.04481 ) ) - t ) ; for ( var j = 0 ; j < 2 ; j ++ ) { var err = erfc ( r ) - xx ; r += err / ( 1.12837916709551257 * Math . exp ( - ( r * r ) ) - r * err ) ; } return ( x < 1 ) ? r : - r ; }
Inverse complementary error function From Numerical Recipes 3e p265
Inverse complementary error function From Numerical Recipes 3e p265