R-alpha: Bug & Patch in dbeta.c (0.50 - PreR 7)

Martin Maechler Martin Maechler <maechler@stat.math.ethz.ch>
Tue, 15 Apr 97 21:31:33 +0200


dbeta(1, a,b)  would return 1 instead of 0.

Here is the patch for  ..../src/math/dbeta.c :

--- dbeta.c~	Sun Nov 24 23:43:10 1996
+++ dbeta.c	Tue Apr 15 21:25:30 1997
@@ -23,9 +23,7 @@
 {
 	if (a <= 0.0 || b <= 0.0)
 		DOMAIN_ERROR;
-	if (x <= 0)
+	if (x <= 0 || x >= 1.0)
 		return 0.0;
-	if (x >= 1.0)
-		return 1.0;
 	return MATH_CHECK(pow(x, a - 1) * pow(1.0 - x, b - 1.0) / beta(a, b));
 }
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-