aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/gpu_basic.cu18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/gpu_basic.cu b/test/gpu_basic.cu
index b2e657e72..bf8dcacde 100644
--- a/test/gpu_basic.cu
+++ b/test/gpu_basic.cu
@@ -343,6 +343,21 @@ struct matrix_inverse {
}
};
+template<typename T>
+struct numeric_limits_test {
+ EIGEN_DEVICE_FUNC
+ void operator()(int i, const typename T::Scalar* in, typename T::Scalar* out) const
+ {
+ EIGEN_UNUSED_VARIABLE(in)
+ int out_idx = i * 5;
+ out[out_idx++] = numext::numeric_limits<float>::epsilon();
+ out[out_idx++] = (numext::numeric_limits<float>::max)();
+ out[out_idx++] = (numext::numeric_limits<float>::min)();
+ out[out_idx++] = numext::numeric_limits<float>::infinity();
+ out[out_idx++] = numext::numeric_limits<float>::quiet_NaN();
+ }
+};
+
template<typename Type1, typename Type2>
bool verifyIsApproxWithInfsNans(const Type1& a, const Type2& b, typename Type1::Scalar* = 0) // Enabled for Eigen's type only
{
@@ -434,6 +449,9 @@ EIGEN_DECLARE_TEST(gpu_basic)
CALL_SUBTEST( run_and_compare_to_gpu(complex_operators<Vector3cf>(), nthreads, cfin, cfout) );
CALL_SUBTEST( test_with_infs_nans(complex_sqrt<Vector3cf>(), nthreads, cfin, cfout) );
+ // numeric_limits
+ CALL_SUBTEST( test_with_infs_nans(numeric_limits_test<Vector3f>(), 1, in, out) );
+
#if defined(__NVCC__)
// FIXME
// These subtests compiles only with nvcc and fail with HIPCC and clang-cuda