diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2018-12-04 12:44:40 +0100 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2018-12-06 12:49:27 +0100 |
commit | 5740790582097fe70d933e9cc9c71be45dcd9f32 (patch) | |
tree | 572ee3198ae50a3545a6d6b12832ebeaf3ec3a3a | |
parent | 9fe049918965c8ffa5bc8245f17ea7376539db8a (diff) |
fix OpenCL ROUND() when the second parameter is negative
Change-Id: Ibbf374f72e83609a602504d9ffde922896338c2c
Reviewed-on: https://gerrit.libreoffice.org/64543
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
(cherry picked from commit 79ed7bbacae43468b690a3d3a6b1acf31e641cee)
Reviewed-on: https://gerrit.libreoffice.org/64609
-rw-r--r-- | sc/source/core/opencl/op_math.cxx | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sc/source/core/opencl/op_math.cxx b/sc/source/core/opencl/op_math.cxx index 341c3b04c333..ec4a75daa9eb 100644 --- a/sc/source/core/opencl/op_math.cxx +++ b/sc/source/core/opencl/op_math.cxx @@ -1609,6 +1609,7 @@ void OpLn::GenSlidingWindowFunction( void OpRound::GenSlidingWindowFunction(std::stringstream &ss, const std::string &sSymName, SubArguments &vSubArguments) { + CHECK_PARAMETER_COUNT( 1, 2 ); ss << "\ndouble " << sSymName; ss << "_"<< BinFuncName() <<"("; for (size_t i = 0; i < vSubArguments.size(); i++) @@ -1626,12 +1627,16 @@ void OpRound::GenSlidingWindowFunction(std::stringstream &ss, { ss << " for(int i=0;i<tmp1;i++)\n"; ss << " tmp0 = tmp0 * 10;\n"; + ss << " for(int i=0;i>tmp1;i--)\n"; + ss << " tmp0 = tmp0 / 10;\n"; } ss << " double tmp=round(tmp0);\n"; if(vSubArguments.size() ==2) { ss << " for(int i=0;i<tmp1;i++)\n"; ss << " tmp = tmp / 10;\n"; + ss << " for(int i=0;i>tmp1;i--)\n"; + ss << " tmp = tmp * 10;\n"; } ss << " return tmp;\n"; ss << "}"; |