Full_Name: Morten Welinder
Version: 2.1.0
OS: src only
Submission from: (NULL) (

Now that pcauchy has been fixed, it is becoming clear that qcauchy suffers from
the same problems.


should yield 1e100 back, but I get 1.633178e+16.  The code below does much
better.  Notes:

1. p need not be finite.  -Inf is ok in the log_p case and R_Q_P01_check
   already checks things.

2. No need to disallow scale=0 and infinite location.

3. The code below uses isnan and finite directly.  It needs to be adapted to
   R way of doing that.

qcauchy (double p, double location, double scale, int lower_tail, int log_p)
        if (isnan(p) || isnan(location) || isnan(scale))
                return p + location + scale;

        if (scale < 0 || !finite(scale)) ML_ERR_return_NAN;

        if (log_p) {
                if (p > -1)
                        lower_tail = !lower_tail, p = -expm1 (p);
                        p = exp (p);
        if (lower_tail) scale = -scale;
        return location + scale / tan(M_PI * p);

R-devel@stat.math.ethz.ch mailing list

Reply via email to