[gnumeric] dpois_raw: handle x=0.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] dpois_raw: handle x=0.
- Date: Sat, 2 Nov 2013 00:06:19 +0000 (UTC)
commit 025f887cb4564e1531f658d53569d7ab40558068
Author: Morten Welinder <terra gnome org>
Date: Fri Nov 1 20:05:50 2013 -0400
dpois_raw: handle x=0.
ChangeLog | 4 ++++
src/mathfunc.c | 2 +-
2 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 2189ed0..6df135d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2013-11-01 Morten Welinder <terra gnome org>
+
+ * src/mathfunc.c (dpois_raw): Handler x=0 as in newer R.
+
2013-10-31 Morten Welinder <terra gnome org>
* src/mathfunc.c (qgamma): Flip tail for high values of p. This
diff --git a/src/mathfunc.c b/src/mathfunc.c
index 7b4db5a..a9e9b36 100644
--- a/src/mathfunc.c
+++ b/src/mathfunc.c
@@ -1080,7 +1080,7 @@ static gnm_float dpois_raw(gnm_float x, gnm_float lambda, gboolean give_log)
if (lambda == 0) return( (x == 0) ? R_D__1 : R_D__0 );
if (!gnm_finite(lambda)) return R_D__0;
if (x < 0) return( R_D__0 );
- if (x < lambda * GNM_MIN) return(R_D_exp(-lambda) );
+ if (x <= lambda * GNM_MIN) return(R_D_exp(-lambda) );
if (lambda < x * GNM_MIN) return(R_D_exp(-lambda + x*gnm_log(lambda) -lgamma1p (x)));
return(R_D_fexp( M_2PIgnum*x, -stirlerr(x)-bd0(x,lambda) ));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]