The R Project SVN R

Rev

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

Rev 60970 Rev 60971
Line 72... Line 72...
72
 
72
 
73
    if (a + b < xmax) {/* ~= 171.61 for IEEE */
73
    if (a + b < xmax) {/* ~= 171.61 for IEEE */
74
//	return gammafn(a) * gammafn(b) / gammafn(a+b);
74
//	return gammafn(a) * gammafn(b) / gammafn(a+b);
75
	/* All the terms are positive, and all can be large for large
75
	/* All the terms are positive, and all can be large for large
76
	   or small arguments.  They are never much less than one.
76
	   or small arguments.  They are never much less than one.
77
	   gammafn(x) can still overflow for x ~ 1e-308.
77
	   gammafn(x) can still overflow for x ~ 1e-308, 
78
	   No point in using lbeta as that uses log(this formula).
78
	   but the result would too. 
79
	*/
79
	*/
80
	return (1 / gammafn(a+b)) * gammafn(a) * gammafn(b);
80
	return (1 / gammafn(a+b)) * gammafn(a) * gammafn(b);
81
    } else {
81
    } else {
82
	double val = lbeta(a, b);
82
	double val = lbeta(a, b);
83
	if (val < lnsml) {
83
	if (val < lnsml) {