Esempio n. 1
0
double attribute_hidden
pnbeta2(double x, double o_x, double a, double b, double ncp,
        /* o_x  == 1 - x  but maybe more accurate */
        int lower_tail, int log_p)
{
    long double ans = pnbeta_raw(x, o_x, a,b, ncp);

    /* return R_DT_val(ans), but we want to warn about cancellation here */
    if (lower_tail) return (double) (log_p ? logl(ans) : ans);
    else {
        if(ans > 1 - 1e-10) ML_ERROR(ME_PRECISION, "pnbeta");
        ans = fmin2(ans, 1.0);  /* Precaution */
        return (double) (log_p ? log1p((double)-ans) : (1. - ans));
    }
}
Esempio n. 2
0
double attribute_hidden
pnbeta2(double x, double o_x, double a, double b, double ncp,
	/* o_x  == 1 - x  but maybe more accurate */
	int lower_tail, int log_p)
{
    LDOUBLE ans = pnbeta_raw(x, o_x, a,b, ncp);


    /* return R_DT_val(ans), but we want to warn about cancellation here */
    if (lower_tail)
#ifdef HAVE_LONG_DOUBLE
	return (double) (log_p ? logl(ans) : ans);
#else
	return log_p ? log(ans) : ans;
#endif
    else {
	if (ans > 1. - 1e-10) ML_ERROR(ME_PRECISION, "pnbeta");