[gnumeric] SFTEST: improve extreme-case precision.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] SFTEST: improve extreme-case precision.
- Date: Sat, 12 Jun 2010 01:26:56 +0000 (UTC)
commit 67dadcd050019784f20a665569226a1af4721842
Author: Morten Welinder <terra gnome org>
Date: Fri Jun 11 21:26:38 2010 -0400
SFTEST: improve extreme-case precision.
NEWS | 2 ++
plugins/fn-stat/ChangeLog | 2 ++
plugins/fn-stat/functions.c | 10 +++++-----
3 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/NEWS b/NEWS
index b3ece5a..4565231 100644
--- a/NEWS
+++ b/NEWS
@@ -32,6 +32,8 @@ Morten:
* Mark a sheet dirty when its tab colour is changed. [#621191]
* Fix SERIESSUM issue.
* Modernize code for LINEST, LOGEST, and LOGREG. [#317426]
+ * GEOMDIST: avoid overflow in extreme cases.
+ * SFTEST: improve extreme-case precision.
--------------------------------------------------------------------------
Gnumeric 1.10.5
diff --git a/plugins/fn-stat/ChangeLog b/plugins/fn-stat/ChangeLog
index 4a311d7..cbf0b2f 100644
--- a/plugins/fn-stat/ChangeLog
+++ b/plugins/fn-stat/ChangeLog
@@ -5,6 +5,8 @@
(gnumeric_linest, gnumeric_logreg, gnumeric_logest): Simplify
using gnm_reg_data_collect. Fixes #317426.
(gnumeric_geomdist): Avoid using "int" for "k".
+ (gnumeric_sftest): Avoid using reserved identifier. Improve
+ precision in extreme cases.
2010-06-10 Andreas J. Guelzow <aguelzow pyrshep ca>
diff --git a/plugins/fn-stat/functions.c b/plugins/fn-stat/functions.c
index a3d4655..3de31e4 100644
--- a/plugins/fn-stat/functions.c
+++ b/plugins/fn-stat/functions.c
@@ -4831,7 +4831,7 @@ gnumeric_sftest (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
value_new_error_VALUE (ei->pos));
} else {
int i;
- gnm_float stat;
+ gnm_float stat_;
gnm_float *ys;
gnm_float *zs;
@@ -4841,7 +4841,7 @@ gnumeric_sftest (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
for (i = 0; i < n; i++)
zs[i] = qnorm ((((gnm_float)(i+1))-3./8.)/(n+0.25), 0., 1., TRUE, FALSE);
- if (gnm_range_correl_pop (ys, zs, n, &stat)) {
+ if (gnm_range_correl_pop (ys, zs, n, &stat_)) {
value_array_set (result, 0, 0,
value_new_error_VALUE (ei->pos));
value_array_set (result, 0, 1,
@@ -4850,17 +4850,17 @@ gnumeric_sftest (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
gnm_float p;
gnm_float u, v, mu, sig;
- stat = stat * stat;
+ stat_ = stat_ * stat_;
value_array_set (result, 0, 1,
- value_new_float (stat));
+ value_new_float (stat_));
u = gnm_log (n);
v = gnm_log (u);
mu = -1.2725 + 1.0521 * (v - u);
sig = 1.0308 - 0.26758 * (v + 2./u);
- p = pnorm (gnm_log (1. - stat), mu, sig, FALSE, FALSE);
+ p = pnorm (gnm_log1p (-stat_), mu, sig, FALSE, FALSE);
value_array_set (result, 0, 0,
value_new_float (p));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]