Fix testing of log nearby 1

This commit is contained in:
Gael Guennebaud 2016-07-22 15:44:26 +02:00
parent 7acf23c14c
commit d7a0e52478

View File

@ -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);