[gnumeric] fix binom.dist.range



commit adfe9b40943a0ca26d2a2d0afa60e0295f447823
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Mon Jun 14 18:40:30 2010 -0600

    fix binom.dist.range
    
    2010-06-14 Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* src/mathfunc.c (pbinom2): pbinom's right tail calculation
    	  does not include the lower limit.

 ChangeLog      |    5 +++++
 src/mathfunc.c |    5 ++++-
 2 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index f1f9aa9..499855e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2010-06-14 Andreas J. Guelzow <aguelzow pyrshep ca>
 
+	* src/mathfunc.c (pbinom2): pbinom's right tail calculation
+	  does not include the lower limit.
+
+2010-06-14 Andreas J. Guelzow <aguelzow pyrshep ca>
+
 	* src/wbc-gtk-edit.c (wbcg_edit_finish): close the tooltips of
 	  the entry
 
diff --git a/src/mathfunc.c b/src/mathfunc.c
index dcb9a59..a6bbc02 100644
--- a/src/mathfunc.c
+++ b/src/mathfunc.c
@@ -6325,8 +6325,11 @@ pbinom2 (gnm_float x0, gnm_float x1, gnm_float n, gnm_float p)
 	if (x0 == x1)
 		return dbinom (x0, n, p, FALSE);
 
+	if (x0 <= 0)
+		return pbinom (x1, n, p, TRUE, FALSE);
+
 	if (x1 >= n)
-		return pbinom (x0, n, p, FALSE, FALSE);
+		return pbinom (x0 - 1, n, p, FALSE, FALSE);
 
 	Pl = pbinom (x0 - 1, n, p, TRUE, FALSE);
 	if (Pl > 0.75) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]