summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/qa/unit/data/xls/opencl/statistical/Covar.xlsbin0 -> 8192 bytes
-rw-r--r--sc/qa/unit/opencl-test.cxx27
-rw-r--r--sc/source/core/tool/token.cxx1
3 files changed, 28 insertions, 0 deletions
diff --git a/sc/qa/unit/data/xls/opencl/statistical/Covar.xls b/sc/qa/unit/data/xls/opencl/statistical/Covar.xls
new file mode 100644
index 000000000000..fc559b0d50c3
--- /dev/null
+++ b/sc/qa/unit/data/xls/opencl/statistical/Covar.xls
Binary files differ
diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx
index cebdfa2909bf..07828836557e 100644
--- a/sc/qa/unit/opencl-test.cxx
+++ b/sc/qa/unit/opencl-test.cxx
@@ -238,6 +238,7 @@ public:
void testStatisticalFormulaTInv();
void testArrayFormulaSumXMY2();
void testStatisticalFormulaStDevP();
+ void testStatisticalFormulaCovar();
CPPUNIT_TEST_SUITE(ScOpenclTest);
CPPUNIT_TEST(testSharedFormulaXLS);
CPPUNIT_TEST(testFinacialFormula);
@@ -407,6 +408,7 @@ public:
CPPUNIT_TEST(testStatisticalFormulaTInv);
CPPUNIT_TEST(testArrayFormulaSumXMY2);
CPPUNIT_TEST(testStatisticalFormulaStDevP);
+ CPPUNIT_TEST(testStatisticalFormulaCovar);
CPPUNIT_TEST_SUITE_END();
private:
@@ -1951,6 +1953,31 @@ void ScOpenclTest::testMathFormulaCosh()
xDocSh->DoClose();
xDocShRes->DoClose();
}
+void ScOpenclTest::testStatisticalFormulaCovar()
+{
+ if (!detectOpenCLDevice())
+ return;
+
+ ScDocShellRef xDocSh = loadDoc("opencl/statistical/Covar.", XLS);
+ ScDocument* pDoc = xDocSh->GetDocument();
+ CPPUNIT_ASSERT(pDoc);
+ enableOpenCL();
+ pDoc->CalcAll();
+
+ ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Covar.", XLS);
+ ScDocument* pDocRes = xDocShRes->GetDocument();
+ CPPUNIT_ASSERT(pDocRes);
+ // Check the results of formula cells in the shared formula range.
+ for (SCROW i = 0; i <= 16; ++i)
+ {
+ double fLibre = pDoc->GetValue(ScAddress(2,i,0));
+ double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
+ }
+ xDocSh->DoClose();
+ xDocShRes->DoClose();
+}
+
//[AMLOEXT-87]
void ScOpenclTest::testStatisticalFormulaKurt()
{
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 77ea7362727d..b8a509536049 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -1469,6 +1469,7 @@ void ScTokenArray::CheckToken( const FormulaToken& r )
case ocTInv:
case ocSumXMY2:
case ocStDevP:
+ case ocCovar:
// Don't change the state.
break;
default: