[gnumeric] BITAND: Fix.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] BITAND: Fix.
- Date: Sun, 6 Feb 2022 16:52:41 +0000 (UTC)
commit 52fb02687367d8b5deb34177bba3761051845bb4
Author: Morten Welinder <terra gnome org>
Date: Sun Feb 6 11:52:16 2022 -0500
BITAND: Fix.
Also improve test sheet for bit operations.
NEWS | 2 ++
plugins/fn-numtheory/numtheory.c | 10 +++++-----
samples/excel/bitwise.xls | Bin 400384 -> 3934 bytes
3 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/NEWS b/NEWS
index d3bf3b5bd..f60d26be5 100644
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,8 @@ Morten:
* Fix import of mildly broken print settings in xlsx files from
OnlyOffice.
* Various --with-long-double fixes.
+ * Fix BITAND.
+ * Test improvements.
--------------------------------------------------------------------------
Gnumeric 1.12.51
diff --git a/plugins/fn-numtheory/numtheory.c b/plugins/fn-numtheory/numtheory.c
index b573fc997..c25ebbda1 100644
--- a/plugins/fn-numtheory/numtheory.c
+++ b/plugins/fn-numtheory/numtheory.c
@@ -620,8 +620,6 @@ gnm_range_bitor (gnm_float const *xs, int n, gnm_float *res)
int i;
guint64 acc = 0;
- *res = 0;
-
for (i = 0; i < n; i++) {
gnm_float x = gnm_fake_floor (xs[i]);
if (x < 0 || x > bit_max)
@@ -661,7 +659,8 @@ gnm_range_bitxor (gnm_float const *xs, int n, gnm_float *res)
int i;
guint64 acc = 0;
- *res = 0;
+ if (n == 0)
+ return 1;
for (i = 0; i < n; i++) {
gnm_float x = gnm_fake_floor (xs[i]);
@@ -700,9 +699,10 @@ static int
gnm_range_bitand (gnm_float const *xs, int n, gnm_float *res)
{
int i;
- guint64 acc = 0;
+ guint64 acc = (guint64)-1;
- *res = 0;
+ if (n == 0)
+ return 1;
for (i = 0; i < n; i++) {
gnm_float x = gnm_fake_floor (xs[i]);
diff --git a/samples/excel/bitwise.xls b/samples/excel/bitwise.xls
index 782714eb5..004f2a3a0 100644
Binary files a/samples/excel/bitwise.xls and b/samples/excel/bitwise.xls differ
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]