The R Project SVN R

Rev

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

Rev 18689 Rev 19799
Line 30... Line 30...
30
    if (ISNAN(x) || ISNAN(n) || ISNAN(p))
30
    if (ISNAN(x) || ISNAN(n) || ISNAN(p))
31
	return x + n + p;
31
	return x + n + p;
32
    if (!R_FINITE(n) || !R_FINITE(p)) ML_ERR_return_NAN;
32
    if (!R_FINITE(n) || !R_FINITE(p)) ML_ERR_return_NAN;
33
 
33
 
34
#endif
34
#endif
35
    if(n != floor(n + 0.5)) ML_ERR_return_NAN;
35
    if(R_D_nonint(n)) ML_ERR_return_NAN;
-
 
36
    n = R_D_forceint(n);
36
    if(n <= 0 || p < 0 || p > 1) ML_ERR_return_NAN;
37
    if(n <= 0 || p < 0 || p > 1) ML_ERR_return_NAN;
37
 
38
 
38
    x = floor(x);
39
    x = floor(x + 1e-7);
39
    if (x < 0.0) return R_DT_0;
40
    if (x < 0.0) return R_DT_0;
40
    if (n <= x) return R_DT_1;
41
    if (n <= x) return R_DT_1;
41
    return pbeta(1 - p, n - x, x + 1, lower_tail, log_p);
42
    return pbeta(1 - p, n - x, x + 1, lower_tail, log_p);
42
}
43
}