Skip to content

Commit

Permalink
Add test for copysign
Browse files Browse the repository at this point in the history
Signed-off-by: Matthias Kretz <kretz@kde.org>
  • Loading branch information
mattkretz committed Dec 15, 2015
1 parent 2701e14 commit f121987
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion tests/math.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1063,6 +1063,17 @@ TEST_TYPES(V, testUlpDiff, (REAL_VECTORS, SIMD_REAL_ARRAY_LIST)) //{{{1
}
}

// TODO: copysign
// copysign {{{1
TEST_TYPES(V, testCopysign, (REAL_VECTORS, SIMD_REAL_ARRAY_LIST))
{
const V x = V::Random();
const V y = -x;
const V z = copysign(x, y);
COMPARE(abs(x), abs(z));
COMPARE(y > 0, z > 0);
COMPARE(z, V::generate([&](int i) { return std::copysign(x[i], y[i]); }));
}

//}}}1

// vim: foldmethod=marker

0 comments on commit f121987

Please sign in to comment.