[gnumeric] TDIST: fix x<0 case.
- From: Morten Welinder <mortenw src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnumeric] TDIST: fix x<0 case.
- Date: Wed, 20 Jan 2010 20:15:35 +0000 (UTC)
commit 2958d438ca1bb5dfed7a4407c8f3c2a644ed6182
Author: Morten Welinder <terra gnome org>
Date: Wed Jan 20 15:15:13 2010 -0500
TDIST: fix x<0 case.
NEWS | 1 +
plugins/fn-stat/ChangeLog | 1 +
plugins/fn-stat/functions.c | 5 ++---
3 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/NEWS b/NEWS
index a6e3a6d..91e6f74 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,7 @@ Gnumeric 1.9.19
Morten:
* Fix TRIMMEAN border case. [#607562]
+ * Fix TDIST border case. [#607008]
--------------------------------------------------------------------------
Gnumeric 1.9.18
diff --git a/plugins/fn-stat/ChangeLog b/plugins/fn-stat/ChangeLog
index 124a331..69d1a39 100644
--- a/plugins/fn-stat/ChangeLog
+++ b/plugins/fn-stat/ChangeLog
@@ -2,6 +2,7 @@
* functions.c (gnumeric_trimmean): Fix p==1 case. Return right
error value.
+ (gnumeric_tdist): Don't allow negative x. Fixes #607008.
2010-01-19 Morten Welinder <terra gnome org>
diff --git a/plugins/fn-stat/functions.c b/plugins/fn-stat/functions.c
index 7bf9203..b61fc78 100644
--- a/plugins/fn-stat/functions.c
+++ b/plugins/fn-stat/functions.c
@@ -1211,11 +1211,10 @@ gnumeric_tdist (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
gnm_float dof = value_get_as_float (argv[1]);
int tails = value_get_as_int (argv[2]);
- if (dof < 1 || (tails != 1 && tails != 2))
+ if (x < 0 || dof < 1 || (tails != 1 && tails != 2))
return value_new_error_NUM (ei->pos);
- return value_new_float (tails * pt ((tails == 1) ? x : gnm_abs(x),
- dof, FALSE, FALSE));
+ return value_new_float (tails * pt (x, dof, FALSE, FALSE));
}
/***************************************************************************/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]