[gnumeric] LINEST: fill unused stat entries with NA, not 0.



commit aa15dbb76a0cd42cb56a55f24f5cbea31ecb9d97
Author: Morten Welinder <terra gnome org>
Date:   Tue May 14 08:51:02 2013 -0400

    LINEST: fill unused stat entries with NA, not 0.

 NEWS                        |    1 +
 plugins/fn-stat/ChangeLog   |    5 +++++
 plugins/fn-stat/functions.c |    9 +++++++++
 3 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/NEWS b/NEWS
index 17e2fa4..5db1757 100644
--- a/NEWS
+++ b/NEWS
@@ -15,6 +15,7 @@ Morten:
        * Add ctrl-shift-z as extra accelerator for redo.  [#699579]
        * Fix conditional format problem.  [#699647]
        * Remove gobject property strings from translation corpus.
+       * Improve LINEST.  [#551457]
 
 --------------------------------------------------------------------------
 Gnumeric 1.12.2
diff --git a/plugins/fn-stat/ChangeLog b/plugins/fn-stat/ChangeLog
index 9dd9365..c668108 100644
--- a/plugins/fn-stat/ChangeLog
+++ b/plugins/fn-stat/ChangeLog
@@ -1,3 +1,8 @@
+2013-05-14  Morten Welinder  <terra gnome org>
+
+       * functions.c (gnumeric_linest): Set unused entries in the stat
+       matrix to #NA for compatibility.
+
 2013-04-26  Morten Welinder <terra gnome org>
 
        * Release 1.12.2
diff --git a/plugins/fn-stat/functions.c b/plugins/fn-stat/functions.c
index 4b69ca0..2d5c23c 100644
--- a/plugins/fn-stat/functions.c
+++ b/plugins/fn-stat/functions.c
@@ -3418,6 +3418,15 @@ gnumeric_linest (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
        if (withstat) {
                result = value_new_array (dim + 1, 5);
 
+               for (i = 2; i <= dim; i++) {
+                       value_array_set (result, i, 2,
+                                        value_new_error_NA (ei->pos));
+                       value_array_set (result, i, 3,
+                                        value_new_error_NA (ei->pos));
+                       value_array_set (result, i, 4,
+                                        value_new_error_NA (ei->pos));
+               }
+
                value_array_set (result, 0, 2,
                                 value_new_float (extra_stat->sqr_r));
                value_array_set (result, 1, 2,


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