[gnumeric] R.PBINOM: fix p==1 and n==0 cases.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] R.PBINOM: fix p==1 and n==0 cases.
- Date: Fri, 12 Apr 2013 17:34:39 +0000 (UTC)
commit ca00c7901a145383a17bcf49c15be2908baab68f
Author: Morten Welinder <terra gnome org>
Date: Fri Apr 12 13:34:20 2013 -0400
R.PBINOM: fix p==1 and n==0 cases.
ChangeLog | 2 ++
NEWS | 1 +
src/mathfunc.c | 2 +-
3 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index b85d11a..139dbc2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,8 @@
* src/mathfunc.c (gnm_owent): Fix a==1 special case. Part of
#697850.
+ (pnbinom): Allow prob==1 (already fixed in R) and n==0 (now
+ reported to R).
2013-04-11 Morten Welinder <terra gnome org>
diff --git a/NEWS b/NEWS
index 950c95a..fb7bba8 100644
--- a/NEWS
+++ b/NEWS
@@ -35,6 +35,7 @@ Morten:
* Ensure full precision for complex numbers. [#697634]
* Fix parsing of 'Sheet1!#REF!' as used by XL. [#683494]
* New function NT_OMEGA.
+ * Fix minor R.PBINOM problems.
--------------------------------------------------------------------------
Gnumeric 1.12.1
diff --git a/src/mathfunc.c b/src/mathfunc.c
index 7d3dc11..5b52a7e 100644
--- a/src/mathfunc.c
+++ b/src/mathfunc.c
@@ -2998,7 +2998,7 @@ gnm_float pnbinom(gnm_float x, gnm_float n, gnm_float p, gboolean lower_tail, gb
return x + n + p;
if(!gnm_finite(n) || !gnm_finite(p)) ML_ERR_return_NAN;
#endif
- if (n <= 0 || p <= 0 || p >= 1) ML_ERR_return_NAN;
+ if (n < 0 || p <= 0 || p > 1) ML_ERR_return_NAN;
x = gnm_fake_floor(x);
if (x < 0) return R_DT_0;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]