[gnumeric] IMPOWER: fix powers of zero.



commit 0f3a0c38963ce0b385ea7e843d2e9f0dc7bcf1d9
Author: Morten Welinder <terra gnome org>
Date:   Mon Aug 16 09:12:51 2010 -0400

    IMPOWER: fix powers of zero.

 ChangeLog     |    5 +++++
 NEWS          |    1 +
 src/complex.c |    7 +++++--
 3 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 67f6aed..f15f225 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-08-16  Morten Welinder  <terra gnome org>
+
+	* src/complex.c (complex_pow): Special-case a=0 which the general
+	formula bungles.  Fixes #627014.
+
 2010-08-15  Andreas J. Guelzow <aguelzow pyrshep ca>
 
 	* samples/chart-tests.gnumeric: make sure the images match the graphs
diff --git a/NEWS b/NEWS
index fca8224..5675fc0 100644
--- a/NEWS
+++ b/NEWS
@@ -36,6 +36,7 @@ Jean:
 Morten:
 	* Survive malformed xml files.
 	* Fix win32 random problem.  [#533779]
+	* Fix IMPOWER problem.  [#627014]
 
 --------------------------------------------------------------------------
 Gnumeric 1.10.8
diff --git a/src/complex.c b/src/complex.c
index 7e8a4cc..8bcf219 100644
--- a/src/complex.c
+++ b/src/complex.c
@@ -226,8 +226,11 @@ complex_angle_pi (complex_t const *src)
 void
 complex_pow (complex_t *dst, complex_t const *a, complex_t const *b)
 {
-	if (complex_zero_p (a) && complex_zero_p (b)) {
-		complex_invalid (dst);
+	if (complex_zero_p (a) && complex_real_p (b)) {
+		if (b->re <= 0)
+			complex_invalid (dst);
+		else
+			complex_real (dst, 0);
 	} else {
 		gnm_float res_r, res_a1, res_a2, res_a2_pi, r, arg;
 		complex_t F;



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