[gnumeric] CEIL: Don't return -0.



commit a60c840370825cf1ef512c74964ff9e7a942d1ce
Author: Morten Welinder <terra gnome org>
Date:   Sun Oct 10 13:18:08 2021 -0400

    CEIL: Don't return -0.
    
    Map it to +0.

 NEWS                        | 1 +
 plugins/fn-math/functions.c | 5 ++++-
 2 files changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/NEWS b/NEWS
index 483d939f0..8ab05ab52 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,7 @@ Jean:
 Morten:
        * Fix --with-long-double configuration.
        * Fix applix import/locale problem.
+       * Make sure CEIL doesn't return -0.  [#603]
 
 --------------------------------------------------------------------------
 Gnumeric 1.12.50
diff --git a/plugins/fn-math/functions.c b/plugins/fn-math/functions.c
index d93e61142..1726d6846 100644
--- a/plugins/fn-math/functions.c
+++ b/plugins/fn-math/functions.c
@@ -617,7 +617,10 @@ static GnmFuncHelp const help_ceil[] = {
 static GnmValue *
 gnumeric_ceil (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
 {
-       return value_new_float (gnm_fake_ceil (value_get_as_float (argv[0])));
+       gnm_float x = value_get_as_float (argv[0]);
+       gnm_float y = gnm_fake_ceil (x);
+
+       return value_new_float (y == 0 ? 0 : y);
 }
 
 /***************************************************************************/


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