The R Project SVN R

Rev

Rev 69588 | Rev 79203 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 69588 Rev 72559
Line 1... Line 1...
1
/*
1
/*
2
 *  Copyright (C) 2000-2013 The R Core Team
2
 *  Copyright (C) 2000-2015 The R Core Team
3
 *
3
 *
4
 *  Algorithm AS 226 Appl. Statist. (1987) Vol. 36, No. 2
4
 *  Algorithm AS 226 Appl. Statist. (1987) Vol. 36, No. 2
5
 *  by Russell V. Lenth
5
 *  by Russell V. Lenth
6
 *  Incorporates modification AS R84 from AS Vol. 39, pp311-2, 1990
6
 *  Incorporates modification AS R84 from AS Vol. 39, pp311-2, 1990
7
 *                        and AS R95 from AS Vol. 44, pp551-2, 1995
7
 *                        and AS R95 from AS Vol. 44, pp551-2, 1995
Line 87... Line 87...
87
	/* o_x  == 1 - x  but maybe more accurate */
87
	/* o_x  == 1 - x  but maybe more accurate */
88
	int lower_tail, int log_p)
88
	int lower_tail, int log_p)
89
{
89
{
90
    LDOUBLE ans = pnbeta_raw(x, o_x, a,b, ncp);
90
    LDOUBLE ans = pnbeta_raw(x, o_x, a,b, ncp);
91
 
91
 
92
 
-
 
93
    /* return R_DT_val(ans), but we want to warn about cancellation here */
92
    /* return R_DT_val(ans), but we want to warn about cancellation here */
94
    if (lower_tail)
93
    if (lower_tail)
95
#ifdef HAVE_LONG_DOUBLE
94
#ifdef HAVE_LONG_DOUBLE
96
	return (double) (log_p ? logl(ans) : ans);
95
	return (double) (log_p ? logl(ans) : ans);
97
#else
96
#else