summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/opencl/op_math.cxx15
1 files changed, 9 insertions, 6 deletions
diff --git a/sc/source/core/opencl/op_math.cxx b/sc/source/core/opencl/op_math.cxx
index 9e676a4f7447..d27476de29c0 100644
--- a/sc/source/core/opencl/op_math.cxx
+++ b/sc/source/core/opencl/op_math.cxx
@@ -1974,13 +1974,16 @@ void OpTrunc::GenSlidingWindowFunction(std::stringstream &ss,
ss << ";\n";
}
}
+ ss << " double argm = arg[0];\n";
ss << " int n = (int)arg[1];\n";
- ss << " int nn = 1;\n";
- ss << " for(int i=0; i<n; ++i)\n";
- ss << " nn *= 10;\n";
- ss << " n = (int)(arg[0] * nn);\n";
- ss << " arg[0] = (double)n / nn;\n";
- ss << " return arg[0];\n";
+ ss << " double nn = 1.0f;\n";
+ ss << " for(int i = 0; i < n; ++i)\n";
+ ss << " {\n";
+ ss << " argm = argm * 10;\n";
+ ss << " nn = nn * 10;\n";
+ ss << " }\n";
+ ss << " modf(argm, &argm);\n";
+ ss << " return argm / nn;\n";
ss << "}";
}
void OpFloor::GenSlidingWindowFunction(