gnumeric r17248 - trunk/plugins/fn-financial



Author: mortenw
Date: Sun Mar 29 00:03:04 2009
New Revision: 17248
URL: http://svn.gnome.org/viewvc/gnumeric?rev=17248&view=rev

Log:
2009-03-28  Morten Welinder  <terra gnome org>

	* functions.c (gnm_range_xirr): Try -1 too.



Modified:
   trunk/plugins/fn-financial/ChangeLog
   trunk/plugins/fn-financial/functions.c

Modified: trunk/plugins/fn-financial/functions.c
==============================================================================
--- trunk/plugins/fn-financial/functions.c	(original)
+++ trunk/plugins/fn-financial/functions.c	Sun Mar 29 00:03:04 2009
@@ -1981,6 +1981,9 @@
 		double r;
 		int i;
 
+		/* This is likely to be on the left side of the root. */
+		(void)goal_seek_point (&xirr_npv, &data, &p, -1);
+
 		for (i = 1; i <= 1024; i += i) {
 			(void)goal_seek_point (&xirr_npv, &data, &p, -1 + 10.0 / (i + 9));
 			(void)goal_seek_point (&xirr_npv, &data, &p, i);
@@ -1988,14 +1991,6 @@
 			if (status == GOAL_SEEK_OK)
 				break;
 		}
-
-		/* Try insanely close to -1.  */
-		for (r = GNM_EPSILON; r < 0.02; r *= 2) {
-			(void)goal_seek_point (&xirr_npv, &data, &p, -1 + r);
-			status = goal_seek_bisection (&xirr_npv, &data, &p);
-			if (status == GOAL_SEEK_OK)
-				break;
-		}
 	}
 
 	if (status == GOAL_SEEK_OK) {



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