[Libreoffice-commits] core.git: Branch 'libreoffice-6-2' - 2 commits - sc/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Thu Dec 6 11:49:50 UTC 2018
sc/source/core/opencl/formulagroupcl.cxx | 1 +
sc/source/core/opencl/op_addin.cxx | 18 ++++++------------
sc/source/core/opencl/op_math.cxx | 5 +++++
3 files changed, 12 insertions(+), 12 deletions(-)
New commits:
commit 6aa5db61725c46a3f4f6b310bac9db1c2984fe6f
Author: Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Tue Dec 4 12:36:46 2018 +0100
Commit: Luboš Luňák <l.lunak at collabora.com>
CommitDate: Thu Dec 6 12:49:38 2018 +0100
better/sane error checking in OpenCL BESSELJ()
Change-Id: I1f1945e7fd2721a320ab11196385e22a70d3da70
Reviewed-on: https://gerrit.libreoffice.org/64542
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak at collabora.com>
(cherry picked from commit 9881ac6874d0001795e5c8892e2d5ac80eeacdc8)
Reviewed-on: https://gerrit.libreoffice.org/64610
diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx
index 25dd22da6a7a..6ba5ba23d6e9 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -43,6 +43,7 @@ static const char* const publicFunc =
"#define IllegalArgument 502\n"
"#define IllegalFPOperation 503 // #NUM!\n"
"#define NoValue 519 // #VALUE!\n"
+ "#define NoConvergence 523\n"
"#define DivisionByZero 532 // #DIV/0!\n"
"#define NOTAVAILABLE 0x7fff // #N/A\n"
"\n"
diff --git a/sc/source/core/opencl/op_addin.cxx b/sc/source/core/opencl/op_addin.cxx
index 5feabef7076b..4dcfc9f8a59e 100644
--- a/sc/source/core/opencl/op_addin.cxx
+++ b/sc/source/core/opencl/op_addin.cxx
@@ -19,6 +19,7 @@ namespace sc { namespace opencl {
void OpBesselj::GenSlidingWindowFunction(std::stringstream &ss,
const std::string &sSymName, SubArguments &vSubArguments)
{
+ CHECK_PARAMETER_COUNT( 2, 2 );
ss << "\ndouble " << sSymName;
ss << "_" << BinFuncName() << "(";
for (size_t i = 0; i < vSubArguments.size(); i++)
@@ -31,11 +32,6 @@ void OpBesselj::GenSlidingWindowFunction(std::stringstream &ss,
ss << " int gid0 = get_global_id(0);\n";
ss << " double x = 0.0;\n";
ss << " double N = 0.0;\n";
- if(vSubArguments.size() != 2)
- {
- ss << " return DBL_MAX;\n}\n";
- return ;
- }
FormulaToken *tmpCur0 = vSubArguments[0]->GetFormulaToken();
assert(tmpCur0);
if(ocPush == vSubArguments[0]->GetFormulaToken()->GetOpCode())
@@ -58,8 +54,7 @@ void OpBesselj::GenSlidingWindowFunction(std::stringstream &ss,
}
else
{
- ss << " return DBL_MAX;\n}\n";
- return ;
+ throw Unhandled(__FILE__, __LINE__);
}
}
else
@@ -90,8 +85,7 @@ void OpBesselj::GenSlidingWindowFunction(std::stringstream &ss,
}
else
{
- ss << " return DBL_MAX;\n}\n";
- return ;
+ throw Unhandled(__FILE__, __LINE__);
}
}
else
@@ -104,7 +98,7 @@ void OpBesselj::GenSlidingWindowFunction(std::stringstream &ss,
ss << " double f_PI_DIV_2 = f_PI / 2.0;\n";
ss << " double f_PI_DIV_4 = f_PI / 4.0;\n";
ss << " if( N < 0.0 )\n";
- ss << " return DBL_MAX;\n";
+ ss << " return CreateDoubleError(IllegalArgument);\n";
ss << " if (x == 0.0)\n";
ss << " return (N == 0.0) ? 1.0 : 0.0;\n";
ss << " double fSign = ((int)N % 2 == 1 && x < 0.0) ? -1.0 : 1.0;\n";
@@ -118,7 +112,7 @@ void OpBesselj::GenSlidingWindowFunction(std::stringstream &ss,
ss << " return fSign * sqrt(f_2_DIV_PI/fX)";
ss << "* cos(fX-N*f_PI_DIV_2-f_PI_DIV_4);\n";
ss << " else\n";
- ss << " return DBL_MAX;\n";
+ ss << " return CreateDoubleError(NoConvergence);\n";
ss << " }\n";
ss << " double epsilon = 1.0e-15;\n";
ss << " bool bHasfound = false;\n";
@@ -179,7 +173,7 @@ void OpBesselj::GenSlidingWindowFunction(std::stringstream &ss,
ss << " if (bHasfound)\n";
ss << " return u * fSign;\n";
ss << " else\n";
- ss << " return DBL_MAX;\n";
+ ss << " return CreateDoubleError(NoConvergence);\n";
ss << "}";
}
void OpGestep::GenSlidingWindowFunction(
commit 5740790582097fe70d933e9cc9c71be45dcd9f32
Author: Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Tue Dec 4 12:44:40 2018 +0100
Commit: Luboš Luňák <l.lunak at collabora.com>
CommitDate: Thu Dec 6 12:49:27 2018 +0100
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 at collabora.com>
(cherry picked from commit 79ed7bbacae43468b690a3d3a6b1acf31e641cee)
Reviewed-on: https://gerrit.libreoffice.org/64609
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 << "}";
More information about the Libreoffice-commits
mailing list