diff options
author | Benoit Steiner <benoit.steiner.goog@gmail.com> | 2016-05-11 23:00:03 -0700 |
---|---|---|
committer | Benoit Steiner <benoit.steiner.goog@gmail.com> | 2016-05-11 23:00:03 -0700 |
commit | 886445ce4d010dcd4ed612eb79b963506698d57d (patch) | |
tree | c39e12031c79c2ea73af9f9a649af74613ae3df1 /unsupported/test/cxx11_tensor_thread_pool.cpp | |
parent | 595e8903915832278e79577633cfb9e698bdb60a (diff) |
Avoid unnecessary conversions between floats and doubles
Diffstat (limited to 'unsupported/test/cxx11_tensor_thread_pool.cpp')
-rw-r--r-- | unsupported/test/cxx11_tensor_thread_pool.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/unsupported/test/cxx11_tensor_thread_pool.cpp b/unsupported/test/cxx11_tensor_thread_pool.cpp index cdc11eb21..2ef665f30 100644 --- a/unsupported/test/cxx11_tensor_thread_pool.cpp +++ b/unsupported/test/cxx11_tensor_thread_pool.cpp @@ -91,7 +91,7 @@ void test_multithread_contraction() for (ptrdiff_t i = 0; i < t_result.size(); i++) { VERIFY(&t_result.data()[i] != &m_result.data()[i]); - if (fabs(t_result(i) - m_result(i)) < 1e-4) { + if (fabsf(t_result(i) - m_result(i)) < 1e-4f) { continue; } if (Eigen::internal::isApprox(t_result(i), m_result(i), 1e-4f)) { @@ -132,7 +132,7 @@ void test_contraction_corner_cases() for (ptrdiff_t i = 0; i < t_result.size(); i++) { assert(!(numext::isnan)(t_result.data()[i])); - if (fabs(t_result.data()[i] - m_result.data()[i]) >= 1e-4) { + if (fabsf(t_result.data()[i] - m_result.data()[i]) >= 1e-4f) { std::cout << "mismatch detected at index " << i << " : " << t_result.data()[i] << " vs " << m_result.data()[i] << std::endl; assert(false); } @@ -147,7 +147,7 @@ void test_contraction_corner_cases() m_result = m_left.transpose() * m_right; for (ptrdiff_t i = 0; i < t_result.size(); i++) { assert(!(numext::isnan)(t_result.data()[i])); - if (fabs(t_result.data()[i] - m_result.data()[i]) >= 1e-4) { + if (fabsf(t_result.data()[i] - m_result.data()[i]) >= 1e-4f) { std::cout << "mismatch detected: " << t_result.data()[i] << " vs " << m_result.data()[i] << std::endl; assert(false); } @@ -165,7 +165,7 @@ void test_contraction_corner_cases() m_result = m_left.transpose() * m_right; for (ptrdiff_t i = 0; i < t_result.size(); i++) { assert(!(numext::isnan)(t_result.data()[i])); - if (fabs(t_result.data()[i] - m_result.data()[i]) >= 1e-4) { + if (fabsf(t_result.data()[i] - m_result.data()[i]) >= 1e-4f) { std::cout << "mismatch detected: " << t_result.data()[i] << " vs " << m_result.data()[i] << std::endl; assert(false); } @@ -183,7 +183,7 @@ void test_contraction_corner_cases() m_result = m_left.transpose() * m_right; for (ptrdiff_t i = 0; i < t_result.size(); i++) { assert(!(numext::isnan)(t_result.data()[i])); - if (fabs(t_result.data()[i] - m_result.data()[i]) >= 1e-4) { + if (fabsf(t_result.data()[i] - m_result.data()[i]) >= 1e-4f) { std::cout << "mismatch detected: " << t_result.data()[i] << " vs " << m_result.data()[i] << std::endl; assert(false); } |