The R Project SVN R

Rev

Rev 77685 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 77685 Rev 88401
Line 69... Line 69...
69
	/* p is small, but q is big. */
69
	/* p is small, but q is big. */
70
	corr = lgammacor(q) - lgammacor(p + q);
70
	corr = lgammacor(q) - lgammacor(p + q);
71
	return lgammafn(p) + corr + p - p * log(p + q)
71
	return lgammafn(p) + corr + p - p * log(p + q)
72
		+ (q - 0.5) * log1p(-p / (p + q));
72
		+ (q - 0.5) * log1p(-p / (p + q));
73
    }
73
    }
74
    else {
-
 
75
	/* p and q are small: p <= q < 10. */
74
    else { /* p and q are small: p <= q < 10. */
76
	/* R change for very small args */
75
	/* R change for very small args */
77
	if (p < 1e-306) return lgamma(p) + (lgamma(q) - lgamma(p+q));
76
	if (p < 1e-306) return lgamma(p) + (lgamma(q) - lgamma(p+q));
78
	else return log(gammafn(p) * (gammafn(q) / gammafn(p + q)));
77
	else return log(gammafn(p) * (gammafn(q) / gammafn(p + q)));
79
    }
78
    }
80
}
79
}