summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2016-08-17 13:10:50 +0200
committerStephan Bergmann <sbergman@redhat.com>2016-08-17 13:10:50 +0200
commitea704f00dea2c4fe0a229876993801ea83c3c4a1 (patch)
treeb44378d1f612c0bedac62df45d2e3556e3e2a9b7 /sc
parent9dbaf6b3b6112d9e16fd64ab0ed5dff6e513e5f8 (diff)
Avoid division by zero
...when i == 0. Change-Id: Iae1adbe559370bdba195afb74e83b5c94e5de4e2
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/tool/interpr5.cxx2
1 files changed, 1 insertions, 1 deletions
diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx
index 6cc80b33e91a..2c357dbb99cf 100644
--- a/sc/source/core/tool/interpr5.cxx
+++ b/sc/source/core/tool/interpr5.cxx
@@ -1657,7 +1657,7 @@ void ScInterpreter::ScPow()
if (fVal1 < 0 && fVal2 != 0.0)
{
int i = (int) (1 / fVal2 + ((fVal2 < 0) ? -0.5 : 0.5));
- if (rtl::math::approxEqual(1 / ((double) i), fVal2) && i % 2 != 0)
+ if (i % 2 != 0 && rtl::math::approxEqual(1 / ((double) i), fVal2))
PushDouble(-pow(-fVal1, fVal2));
else
PushDouble(pow(fVal1, fVal2));