[Rd] pcauchy precision (PR#6756)

terra at gnome.org terra at gnome.org
Sun Apr 11 19:04:01 CEST 2004


Full_Name: Morten Welinder
Version: snapshot
OS: 
Submission from: (NULL) (65.213.85.129)


Two things are wrong.

1. There is nan test outside IEEE_754.
2. The meat part of the function should really be something like...

    if (!lower_tail)
	    x = -x;

    if (fabs (x) > 1) {
	    double temp = atan (1 / x) / M_PI;
	    return (x > 0) ? R_D_Clog (temp) : R_D_val (-temp);
    } else
	    return R_D_val (0.5 + atan (x) / M_PI);

...instead of the current heavily truncated series expansion.  The above is
much
simpler and more precise.  (Thanks to Ian Smith for pointing the in-hindsight-
obvious 1/x trick out.)



More information about the R-devel mailing list