Kaydet (Commit) 876a2be1 authored tarafından Tor Lillqvist's avatar Tor Lillqvist Kaydeden (comit) Andras Timar

tdf#94924: Return correct #DIV/0! error from AVERAGE in the OpenCL case

Change-Id: If7326fd1242d90ff92e62d141714960476198605
Signed-off-by: 's avatarMichael Meeks <michael.meeks@collabora.com>
(cherry picked from commit a6fa35ab)
üst 8417c46b
...@@ -1774,6 +1774,10 @@ public: ...@@ -1774,6 +1774,10 @@ public:
ss << ";\n"; ss << ";\n";
} }
} }
if (isAverage())
ss <<
"if (nCount==0)\n"
" return CreateDoubleError(errDivisionByZero);\n";
ss << "return tmp"; ss << "return tmp";
if (isAverage()) if (isAverage())
ss << "*pow((double)nCount,-1.0)"; ss << "*pow((double)nCount,-1.0)";
...@@ -2122,7 +2126,7 @@ public: ...@@ -2122,7 +2126,7 @@ public:
ss << "fsum_count(" << lhs << "," << rhs << ", &nCount)"; ss << "fsum_count(" << lhs << "," << rhs << ", &nCount)";
return ss.str(); return ss.str();
} }
virtual std::string BinFuncName() const SAL_OVERRIDE { return "fsum"; } virtual std::string BinFuncName() const SAL_OVERRIDE { return "average"; }
virtual bool isAverage() const SAL_OVERRIDE { return true; } virtual bool isAverage() const SAL_OVERRIDE { return true; }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment