Skip to content

Commit 847d45d

Browse files
committed
Fix bug in cmul_add tests
marray version never tested!
1 parent 1fe5980 commit 847d45d

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

sycl/test-e2e/syclcompat/math/math_complex.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,15 @@ template <typename T> bool check(T x, float *e) {
5050
return false;
5151
}
5252

53+
template <typename T> bool check(sycl::marray<T, 2> x, float *e) {
54+
float precision = ERROR_TOLERANCE;
55+
if ((x[0] - e[0] < precision) && (x[0] - e[0] > -precision) &&
56+
(x[1] - e[1] < precision) && (x[1] - e[1] > -precision)) {
57+
return true;
58+
}
59+
return false;
60+
}
61+
5362
template <> bool check<float>(float x, float *e) {
5463
float precision = ERROR_TOLERANCE;
5564
if ((x - e[0] < precision) && (x - e[0] > -precision)) {
@@ -206,10 +215,10 @@ void kernel_mul_add(int *result) {
206215
m_f2 = sycl::marray<float, 2>(-3.6, 4.5);
207216
m_f3 = sycl::marray<float, 2>(1.0, -1.0);
208217

209-
auto a3 = syclcompat::cmul_add(d1, d2, d3);
218+
auto a3 = syclcompat::cmul_add(m_d1, m_d2, m_d3);
210219
r = r && check(a3, expect);
211220

212-
auto a4 = syclcompat::cmul_add(f1, f2, f3);
221+
auto a4 = syclcompat::cmul_add(m_f1, m_f2, m_f3);
213222
r = r && check(a4, expect + 2);
214223

215224
*result = r;

0 commit comments

Comments
 (0)