[Libreoffice-commits] core.git: sc/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Dec 4 15:06:22 UTC 2018


 sc/source/core/opencl/formulagroupcl.cxx |    1 +
 sc/source/core/opencl/op_financial.cxx   |    3 +++
 2 files changed, 4 insertions(+)

New commits:
commit de5dd98320533888973432797254bfc5c9b52680
Author:     Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Fri Nov 16 17:22:42 2018 +0100
Commit:     Luboš Luňák <l.lunak at collabora.com>
CommitDate: Tue Dec 4 16:05:59 2018 +0100

    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 at collabora.com>

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";


More information about the Libreoffice-commits mailing list