summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/source/core/opencl/op_math.cxx12
-rw-r--r--sc/source/core/opencl/opinlinefun_math.hxx8
2 files changed, 11 insertions, 9 deletions
diff --git a/sc/source/core/opencl/op_math.cxx b/sc/source/core/opencl/op_math.cxx
index 60b02270fc03..f54f22b88e14 100644
--- a/sc/source/core/opencl/op_math.cxx
+++ b/sc/source/core/opencl/op_math.cxx
@@ -200,19 +200,19 @@ void OpCombina::GenSlidingWindowFunction(std::stringstream &ss,
}
ss << " arg0 = trunc(arg0);\n";
ss << " arg1 = trunc(arg1);\n";
- ss << " if(arg0 < arg1 || arg0 < 0 || arg1 < 0)\n";
- ss << " tem = -1;\n";
+ ss << " if(arg0 >= arg1 && arg0 > 0 && arg1 > 0)\n";
+ ss << " tem = bik(arg0+arg1-1,arg1);\n";
ss << " else if(arg0 == 0 && arg1 == 0)\n";
ss << " tem = 0;\n";
ss << " else if(arg0 > 0 && arg1 == 0)\n";
ss << " tem = 1;\n";
ss << " else\n";
- ss << " tem = bik(arg0+arg1-1,arg1);\n";
- ss << " double k = tem - trunc(tem);\n";
- ss << " if(k < 0.5)\n";
+ ss << " tem = -1;\n";
+ ss << " double i = tem - trunc(tem);\n";
+ ss << " if(i < 0.5)\n";
ss << " tem = trunc(tem);\n";
ss << " else\n";
- ss << " tem = trunc(tem) + 1;";
+ ss << " tem = trunc(tem) + 1;\n";
ss << " return tem;\n";
ss << "}";
}
diff --git a/sc/source/core/opencl/opinlinefun_math.hxx b/sc/source/core/opencl/opinlinefun_math.hxx
index 44196b5ad1e6..b641c522e898 100644
--- a/sc/source/core/opencl/opinlinefun_math.hxx
+++ b/sc/source/core/opencl/opinlinefun_math.hxx
@@ -25,16 +25,18 @@ std::string bikDecl = "double bik(double n,double k);\n";
std::string bik =
"double bik(double n,double k)\n"
"{\n"
-" double nVal = n/k;\n"
+" double nVal1 = n;\n"
+" double nVal2 = k;\n"
" n = n - 1;\n"
" k = k - 1;\n"
" while (k > 0)\n"
" {\n"
-" nVal = nVal * ( n/k );\n"
+" nVal1 = nVal1 * n;\n"
+" nVal2 = nVal2 * k;\n"
" k = k - 1;\n"
" n = n - 1;\n"
" }\n"
-" return nVal;\n"
+" return (nVal1 / nVal2);\n"
"}\n";
std::string local_cothDecl = "double local_coth(double n);\n";