diff options
-rw-r--r-- | sc/source/core/tool/interpr5.cxx | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx index b6d616e11619..e6ca13816579 100644 --- a/sc/source/core/tool/interpr5.cxx +++ b/sc/source/core/tool/interpr5.cxx @@ -1654,7 +1654,20 @@ void ScInterpreter::ScPow() PushIllegalArgument(); } else - PushDouble(pow(fVal1,fVal2)); + { + 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) + PushDouble(-pow(-fVal1, fVal2)); + else + PushDouble(pow(fVal1, fVal2)); + } + else + { + PushDouble(pow(fVal1,fVal2)); + } + } } namespace { |