From d7a0e52478e6f769ce2df51f009d0b3ca535b80b Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Fri, 22 Jul 2016 15:44:26 +0200 Subject: [PATCH] Fix testing of log nearby 1 --- unsupported/test/cxx11_tensor_of_float16_cuda.cu | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/unsupported/test/cxx11_tensor_of_float16_cuda.cu b/unsupported/test/cxx11_tensor_of_float16_cuda.cu index fe2e58929..b6df5a4d2 100644 --- a/unsupported/test/cxx11_tensor_of_float16_cuda.cu +++ b/unsupported/test/cxx11_tensor_of_float16_cuda.cu @@ -188,7 +188,10 @@ void test_cuda_trancendental() { } for (int i = 0; i < num_elem; ++i) { std::cout << "Checking elemwise log " << i << " input = " << input2(i) << " full = " << full_prec2(i) << " half = " << half_prec2(i) << std::endl; - VERIFY_IS_APPROX(full_prec2(i), half_prec2(i)); + if(std::abs(input2(i)-1.f)<0.05f) // log lacks accurary nearby 1 + VERIFY_IS_APPROX(full_prec2(i)+Eigen::half(0.1f), half_prec2(i)+Eigen::half(0.1f)); + else + VERIFY_IS_APPROX(full_prec2(i), half_prec2(i)); } gpu_device.deallocate(d_float1); gpu_device.deallocate(d_float2);