[gnumeric] Calc: work a little harder at avoiding -0.



commit 9f0240bbdf1745ce34bd88618c7e9d712929f902
Author: Morten Welinder <terra gnome org>
Date:   Mon Aug 29 20:05:18 2022 -0400

    Calc: work a little harder at avoiding -0.

 ChangeLog   | 4 ++++
 NEWS        | 1 +
 src/value.c | 1 +
 3 files changed, 6 insertions(+)
---
diff --git a/ChangeLog b/ChangeLog
index 8dabc8963..32bf8bd4d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2022-08-29  Morten Welinder  <terra gnome org>
+
+       * src/value.c (value_new_float): Avoid -0.
+
 2022-08-24  Morten Welinder  <terra gnome org>
 
        * src/gui-util.c (gnm_keyed_dialog): Simplify signal handling.
diff --git a/NEWS b/NEWS
index 29e90fde3..8698240a4 100644
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,7 @@ Morten:
        * Fix midly crazy ROUND edge cases.  [#661]
        * Fix dialog reuse problem.  [#657]
        * Fix sc import problem.  [#663]
+       * Work a little hard at avoiding -0.  [#652]
 
 --------------------------------------------------------------------------
 Gnumeric 1.12.52
diff --git a/src/value.c b/src/value.c
index 5bf639801..c3b3c29cc 100644
--- a/src/value.c
+++ b/src/value.c
@@ -118,6 +118,7 @@ value_new_float (gnm_float f)
 {
        if (gnm_finite (f)) {
                GnmValueFloat *v = CHUNK_ALLOC (GnmValueFloat, value_float_pool);
+               if (f == 0) f = 0; // Avoid -0
                *((GnmValueType *)&(v->type)) = VALUE_FLOAT;
                v->fmt = NULL;
                v->val = f;


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