Skip to content
Back to formatted view

Raw Message

Message-ID: <20040411170401.3E7FBEDF1@slim.kubism.ku.dk>
Date: 2004-04-11T19:04:05Z
From: terra@diku.dk
Subject: pcauchy precision (PR#6756)

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.)