summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2015-10-14 21:47:20 +0300
committerTor Lillqvist <tml@collabora.com>2015-10-15 13:45:44 +0300
commitd67262fb540114b2c29d19cfd4075cc7faa20d74 (patch)
treeb7122fd2fb34c32e4b08a30746c3b6565884e912
parentbdef079b39d273d2985d360a52597672c96b43fc (diff)
tdf#94924: Fix handling of empty cells in OpenCL division
Not sure why the code from f5e7207053b857b6903a0ab9c161bed9ad7bcee9 did not produce correct results any longer. Anyway, now OpenCL division works right in case of empty or zero cells. Clearly I need to add unit tests to make sure this stuff keeps working. In later commits. Change-Id: I93b787ad5da453af1601768308fb614a332ed142
-rw-r--r--sc/source/core/opencl/formulagroupcl.cxx12
1 files changed, 4 insertions, 8 deletions
diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx
index 4c56d03fdf18..7690035c1956 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -2177,20 +2177,16 @@ public:
{
ss <<
"if (isnan(" << vSubArguments[argno]->GenSlidingWindowDeclRef() << ")) {\n"
- " if (GetDoubleErrorValue(" << vSubArguments[argno]->GenSlidingWindowDeclRef() << ") == errNoValue)\n"
- " return CreateDoubleError(errDivisionByZero);\n"
+ " return CreateDoubleError(errDivisionByZero);\n"
"}\n";
return true;
}
else if (argno == 0)
{
ss <<
- "if (isnan(" << vSubArguments[argno]->GenSlidingWindowDeclRef() << ")) {\n"
- " if (GetDoubleErrorValue(" << vSubArguments[argno]->GenSlidingWindowDeclRef() << ") == errNoValue) {\n"
- " if (" << vSubArguments[1]->GenSlidingWindowDeclRef() << " == 0)\n"
- " return CreateDoubleError(errDivisionByZero);\n"
- " return 0;\n"
- " }\n"
+ "if (isnan(" << vSubArguments[argno]->GenSlidingWindowDeclRef() << ") &&\n"
+ " !(isnan(" << vSubArguments[1]->GenSlidingWindowDeclRef() << ") || " << vSubArguments[1]->GenSlidingWindowDeclRef() << " == 0)) {\n"
+ " return 0;\n"
"}\n";
}
return false;