[Libreoffice-commits] core.git: sc/source
Stephan Bergmann
sbergman at redhat.com
Wed Aug 17 11:11:34 UTC 2016
sc/source/core/tool/interpr5.cxx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit ea704f00dea2c4fe0a229876993801ea83c3c4a1
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Wed Aug 17 13:10:50 2016 +0200
Avoid division by zero
...when i == 0.
Change-Id: Iae1adbe559370bdba195afb74e83b5c94e5de4e2
diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx
index 6cc80b3..2c357db 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));
More information about the Libreoffice-commits
mailing list