サブ txp.js Last modified: Mar 25, 2004 function txp(t, df) { var m2pi, t1, t2, p, w, i m2pi = 0.636619772367581343076 t1 = Math.abs(t)/Math.sqrt(df) t2 = 1.0/(1.0+t1*t1) if ((df%2) == 0) { for (w = t1*Math.sqrt(t2), p = 1.0-w, i = 2; i <= df-2; i += 2) { p -= w *= t2*(i-1)/i } } else { p = 1.0-m2pi*Math.atan(t1) if (df >= 3) { for (w = m2pi*t1*t2, p -= w, i = 3; i <= df-2; i += 2) { p -= w *= t2*(i-1)/i } } } return (p < 0.0 && Math.abs(p) < 1e-10) ? 0.0 : p }