サブ gxp.js   Last modified: Mar 25, 2004

function gxp(x)
{
  var is, i, c, p, y, z, pi2
  pi2 = 0.398942280401432677940

  is = -1
  y = Math.abs(x)
  c = y*y
  p = 0.0
  z = Math.exp(-c*0.5)*pi2
  if (y < 2.5) {
    for (i = 20; i > 0; i--) {
      p = i*c/(i*2+1+is*p)
      is = -is
    }
    p = 0.5-z*y/(1.0-p)
  }
  else {
    for (i = 20; i > 0; i--) {
      p = i/(y+p)
    }
    p = z/(y+p)
  }
  return (x < 0.0) ? 1.0-p : p
}


・ 直前のページへ戻る  ・ E-mail to Shigenobu AOKI

Made with Macintosh