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

Tor Lillqvist tml at collabora.com
Fri Mar 6 04:26:51 PST 2015


 sc/source/core/opencl/op_statistical.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 1028643bc7d294e4c32b4ccea288d90088abae53
Author: Tor Lillqvist <tml at collabora.com>
Date:   Fri Mar 6 14:21:24 2015 +0200

    Return a #DIV/0! error in one case in the OpenCL SLOPE() implementation
    
    Instead of a bare NAN.
    
    There are still many places in this function where the code bluntly returns a
    bare NAN. That is always the wrong thing to do. However, it is not certain
    that the #DIV/0! is the right error in all cases. One would need to check in
    each case how to get there, and what the reference C++ implementation and
    other spreadsheet products do in such a case.
    
    Change-Id: I5454609082a92144b1afc3c1745586bfe8ef87f8

diff --git a/sc/source/core/opencl/op_statistical.cxx b/sc/source/core/opencl/op_statistical.cxx
index c9e74f9..fa5027f 100644
--- a/sc/source/core/opencl/op_statistical.cxx
+++ b/sc/source/core/opencl/op_statistical.cxx
@@ -2703,7 +2703,7 @@ void OpSlope::GenSlidingWindowFunction(std::stringstream &ss,
         ss << "            fSumSqrDeltaX += (argX-fMeanX) * (argX-fMeanX);\n";
         ss << "        }\n";
         ss << "        if(fSumSqrDeltaX == 0.0)\n";
-        ss << "            return NAN;\n";
+        ss << "            return CreateDoubleError(errDivisionByZero);\n";
         ss << "        else\n";
         ss << "        {\n";
         ss << "            return fSumDeltaXDeltaY*pow(fSumSqrDeltaX,-1.0);\n";


More information about the Libreoffice-commits mailing list