[gnumeric] GCD: fix case of non-integer first argument.



commit 9c31a9222554fe33bc9d5c3f217b629db0c5a101
Author: Morten Welinder <terra gnome org>
Date:   Tue Jun 9 13:57:08 2009 -0400

    GCD: fix case of non-integer first argument.
---
 NEWS                        |    1 +
 plugins/fn-math/ChangeLog   |    2 ++
 plugins/fn-math/functions.c |    2 +-
 3 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/NEWS b/NEWS
index dcb10fa..f8ad026 100644
--- a/NEWS
+++ b/NEWS
@@ -22,6 +22,7 @@ Morten:
 	* Fix style problems with operator.xls.  [#585178]
 	* Fix NPER problems.
 	* Implement new functions COT and ACOT.  [#585270]
+	* Fix GCD.  [#585271]
 
 --------------------------------------------------------------------------
 Gnumeric 1.9.8
diff --git a/plugins/fn-math/ChangeLog b/plugins/fn-math/ChangeLog
index bfc9648..8483382 100644
--- a/plugins/fn-math/ChangeLog
+++ b/plugins/fn-math/ChangeLog
@@ -1,6 +1,8 @@
 2009-06-09  Morten Welinder  <terra gnome org>
 
 	* functions.c (gnumeric_acot, gnumeric_cot): New functions.
+	(range_gcd): Handle first argument not integer better.  Fixes
+	#585271.
 
 2009-05-23  Morten Welinder <terra gnome org>
 
diff --git a/plugins/fn-math/functions.c b/plugins/fn-math/functions.c
index 5f026d0..76f22ca 100644
--- a/plugins/fn-math/functions.c
+++ b/plugins/fn-math/functions.c
@@ -89,7 +89,7 @@ range_gcd (gnm_float const *xs, int n, gnm_float *res)
 {
 	if (n > 0) {
 		int i;
-		gnm_float gcd_so_far = xs[0];
+		gnm_float gcd_so_far = gnm_fake_floor (xs[0]);
 
 		for (i = 0; i < n; i++) {
 			gnm_float thisx = gnm_fake_floor (xs[i]);



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