diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2018-11-16 17:22:42 +0100 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2018-12-04 16:05:59 +0100 |
commit | de5dd98320533888973432797254bfc5c9b52680 (patch) | |
tree | 184cb0170c1559f4c1ee4c7461d598fc5c5946c3 | |
parent | 271a767d9d8f473ef7829cbf16febe656420959c (diff) |
fix opencl YIELDDISC
Otherwise the yielddisc unittest fails.
Change-Id: I2ebb0fbf9d4aea6678c91d0289418991aa92dbb5
Reviewed-on: https://gerrit.libreoffice.org/64241
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
-rw-r--r-- | sc/source/core/opencl/formulagroupcl.cxx | 1 | ||||
-rw-r--r-- | sc/source/core/opencl/op_financial.cxx | 3 |
2 files changed, 4 insertions, 0 deletions
diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index 02608e3bfb82..ccc6fbbe4f7e 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -40,6 +40,7 @@ static const char* const publicFunc = "\n" + "#define IllegalArgument 502\n" "#define IllegalFPOperation 503 // #NUM!\n" "#define NoValue 519 // #VALUE!\n" "#define DivisionByZero 532 // #DIV/0!\n" diff --git a/sc/source/core/opencl/op_financial.cxx b/sc/source/core/opencl/op_financial.cxx index 6b108eeed2d3..6f728cbbbdd2 100644 --- a/sc/source/core/opencl/op_financial.cxx +++ b/sc/source/core/opencl/op_financial.cxx @@ -3913,6 +3913,7 @@ void OpReceived::GenSlidingWindowFunction(std::stringstream &ss, void OpYielddisc::GenSlidingWindowFunction( std::stringstream &ss, const std::string &sSymName, SubArguments &vSubArguments) { + CHECK_PARAMETER_COUNT(5,5); ss << "\ndouble " << sSymName; ss << "_"<< BinFuncName() <<"("; for (size_t i = 0; i < vSubArguments.size(); i++) @@ -4010,6 +4011,8 @@ void OpYielddisc::GenSlidingWindowFunction( ss << vSubArguments[4]->GenSlidingWindowDeclRef(); ss<<";\n\t"; + ss<< "if(tmp002 <= 0 || tmp003 <= 0 || tmp000 >= tmp001 )\n"; + ss<< " return CreateDoubleError(IllegalArgument);\n"; ss<< "tmp = (tmp003/tmp002)-1;\n\t"; ss << "tmp /= GetYearFrac( GetNullDate(),tmp000,tmp001,tmp004);\n\t"; ss << "return tmp;\n"; |