gnumeric r16648 - in trunk: . plugins/fn-stat



Author: mortenw
Date: Mon Jun 23 01:35:14 2008
New Revision: 16648
URL: http://svn.gnome.org/viewvc/gnumeric?rev=16648&view=rev

Log:
2008-06-22  Morten Welinder  <terra gnome org>

	* functions.c (range_intercept, range_slope): Check that we have
	points at all.  [#539648]



Modified:
   trunk/NEWS
   trunk/plugins/fn-stat/ChangeLog
   trunk/plugins/fn-stat/functions.c

Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS	(original)
+++ trunk/NEWS	Mon Jun 23 01:35:14 2008
@@ -43,6 +43,7 @@
 	* Fix corrupted-xls-file problem.  [#539178]
 	* Fix markup/text confusion.  [#386412]
 	* Fix BESSELI issue.  [#323784]
+	* Fix SLOPE/INTERCEPT critical.  [#539648]
 
 SeÃn de BÃrca:
 	* Move to tango based icons. [#450444]

Modified: trunk/plugins/fn-stat/functions.c
==============================================================================
--- trunk/plugins/fn-stat/functions.c	(original)
+++ trunk/plugins/fn-stat/functions.c	Mon Jun 23 01:35:14 2008
@@ -5141,8 +5141,9 @@
 	gnm_float linres[2];
 	int dim = 1;
 
-	if (gnm_linear_regression ((gnm_float **)&xs, dim,
-			       ys, n, 1, linres, NULL) != REG_ok)
+	if (n <= 0 ||
+	    gnm_linear_regression ((gnm_float **)&xs, dim,
+				   ys, n, 1, linres, NULL) != REG_ok)
 		return 1;
 
 	*res = linres[0];
@@ -5189,8 +5190,9 @@
 	gnm_float linres[2];
 	int dim = 1;
 
-	if (gnm_linear_regression ((gnm_float **)&xs, dim,
-			       ys, n, 1, linres, NULL) != REG_ok)
+	if (n <= 0 ||
+	    gnm_linear_regression ((gnm_float **)&xs, dim,
+				   ys, n, 1, linres, NULL) != REG_ok)
 		return 1;
 
 	*res = linres[1];



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