X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Ftukey%2Fqtukey.c;h=54c174be2074be0378ffaed41c6903106d47e92f;hb=a10db790c0fb0453e9af0a9ad1f0a67ca73a6482;hp=08253df7546b4bb051cedc0e957b3215512e1d14;hpb=32ee0e0402d6d56674f53a47d879ec5c07dabe09;p=pspp diff --git a/lib/tukey/qtukey.c b/lib/tukey/qtukey.c index 08253df754..54c174be20 100644 --- a/lib/tukey/qtukey.c +++ b/lib/tukey/qtukey.c @@ -81,10 +81,8 @@ static double fmax2(double x, double y) { -#ifdef IEEE_754 - if (ISNAN(x) || ISNAN(y)) + if (isnan(x) || isnan(y)) return x + y; -#endif return (x < y) ? y : x; } @@ -145,8 +143,8 @@ static double qinv(double p, double c, double v) ps = 0.5 - 0.5 * p; yi = sqrt (log (1.0 / (ps * ps))); - t = yi + (((( yi * p4 + p3) * yi + p2) * yi + p1) * yi + p0) - / (((( yi * q4 + q3) * yi + q2) * yi + q1) * yi + q0); + t = yi + ((((yi * p4 + p3) * yi + p2) * yi + p1) * yi + p0) + / ((((yi * q4 + q3) * yi + q2) * yi + q1) * yi + q0); if (v < vmax) t += (t * t * t + t) / v / 4.0; q = c1 - c2 * t; if (v < vmax) q += -c3 / v + c4 * t / v; @@ -188,15 +186,20 @@ double qtukey(double p, double rr, double cc, double df, double ans = 0.0, valx0, valx1, x0, x1, xabs; int iter; -#ifdef IEEE_754 - if (ISNAN(p) || ISNAN(rr) || ISNAN(cc) || ISNAN(df)) { - ML_ERROR(ME_DOMAIN, "qtukey"); + if (isnan(p) || isnan(rr) || isnan(cc) || isnan(df)) { + /* ML_ERROR(ME_DOMAIN, "qtukey"); */ return p + rr + cc + df; } -#endif /* df must be > 1 ; there must be at least two values */ - assert (! (df < 2 || rr < 1 || cc < 2) ); + /* ^^ + JMD: The comment says 1 but the code says 2. + Which is correct? + */ + assert (df >= 2); + assert (rr >= 1); + assert (cc >= 2); + R_Q_P01_boundaries (p, 0, ML_POSINF);