[gnumeric] fix abscissae sorting of abscissae in INTERPOLATION



commit f9e266fcb0b704ab01072c765fcf1b3b7e712cd4
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Tue Jul 31 09:47:29 2012 -0600

    fix abscissae sorting of abscissae in INTERPOLATION
    
    2012-07-31 Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* functions.c (gnumeric_interpolation): completely sort the
    	abscissae

 plugins/fn-tsa/ChangeLog   |    5 +++++
 plugins/fn-tsa/functions.c |    8 ++++----
 2 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/plugins/fn-tsa/ChangeLog b/plugins/fn-tsa/ChangeLog
index 3e2e63f..f3cd570 100644
--- a/plugins/fn-tsa/ChangeLog
+++ b/plugins/fn-tsa/ChangeLog
@@ -1,3 +1,8 @@
+2012-07-31 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+	* functions.c (gnumeric_interpolation): completely sort the
+	abscissae
+
 2012-07-31  Jean Brefort  <jean brefort normalesup org>
 
 	* functions.c (linear_averaging): fixed it. [#680723]
diff --git a/plugins/fn-tsa/functions.c b/plugins/fn-tsa/functions.c
index 5dd3a4a..7d1addf 100644
--- a/plugins/fn-tsa/functions.c
+++ b/plugins/fn-tsa/functions.c
@@ -391,8 +391,8 @@ static GnmFuncHelp const help_interpolation[] = {
 	{ GNM_FUNC_HELP_NOTE, F_("If any of interpolation methods 1 ('linear with averaging'), 3 "
 				 "('staircase with averaging'), and 5 ('natural cubic spline with "
 				 "averaging') is used, the number "
-				 "of returned values is one less than the number of targets and the targets "
-				 "values must be given in increasing order. The interpolated values returned"
+				 "of returned values is one less than the number of targets and the target "
+				 "values must be given in increasing order. The values returned"
 				 "are the averages of the interpolation on each interval.") },
 	{ GNM_FUNC_HELP_NOTE, F_("Strings and empty cells in @{abscissae} and @{ordinates} are ignored.") },
 	{ GNM_FUNC_HELP_NOTE, F_("If several target data are provided they must be in the same column in consecutive cells.") },
@@ -490,13 +490,13 @@ gnumeric_interpolation (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
 
 	/* Check whether the abscissae are increasing, if not order them */
 	if (!gnm_range_increasing (vals0, n0)) {
-		gboolean switched = FALSE;
+		gboolean switched = TRUE;
 		if (constp) {
 			vals0 = g_memdup (vals0, sizeof(gnm_float) * n0);
 			vals1 = g_memdup (vals1, sizeof(gnm_float) * n0);
 			constp = FALSE;	
 		}
-		while (!switched) {
+		while (switched) {
 			gnm_float *val;
 			switched = FALSE;
 			for (i = 1, val = vals0; i < n0; i++, val++) {



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