[gnumeric] pow1p: handle NaNs better.



commit 837ff06005316000e8f732fd05d075ca2f57f8e3
Author: Morten Welinder <terra gnome org>
Date:   Sat Jan 2 18:14:14 2016 -0500

    pow1p: handle NaNs better.

 ChangeLog      |    4 ++++
 NEWS           |    2 +-
 src/mathfunc.c |    3 ++-
 3 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index da939b2..b07335c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2016-01-02  Morten Welinder  <terra gnome org>
+
+       * src/mathfunc.c (pow1p): Handle nan.  Fixes #760085.
+
 2016-01-01  Morten Welinder  <terra gnome org>
 
        * src/sheet.c (gnm_sheet_constructed): Chain ->constructed early.
diff --git a/NEWS b/NEWS
index c750fd1..ca2727d 100644
--- a/NEWS
+++ b/NEWS
@@ -8,7 +8,7 @@ Andreas:
 Morten:
        * Teach ssconvert to split sheets into separate .txt files [#694408]
        * Improve test suite.
-       * Fuzzed file fix.  [#760046]
+       * Fuzzed file fixes.  [#760046]  [#760085]
 
 --------------------------------------------------------------------------
 Gnumeric 1.12.26
diff --git a/src/mathfunc.c b/src/mathfunc.c
index 50fb273..cdc22a9 100644
--- a/src/mathfunc.c
+++ b/src/mathfunc.c
@@ -4968,7 +4968,8 @@ pow1p (gnm_float x, gnm_float y)
         * and (2) when |x|>1/2 and we have no better algorithm.
         */
 
-       if ((x + 1) - x == 1 || gnm_abs (x) > 0.5)
+       if ((x + 1) - x == 1 || gnm_abs (x) > 0.5 ||
+           gnm_isnan (x) || gnm_isnan (y))
                return gnm_pow (1 + x, y);
        else if (y < 0)
                return 1 / pow1p (x, -y);


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