Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error aspect fp64 is not supported in tests of std::complex #2029

Merged
merged 5 commits into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions test/support/test_complex.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

#include <type_traits>
#include <cassert>
#include <limits>

#if !_PSTL_MSVC_LESS_THAN_CPP20_COMPLEX_CONSTEXPR_BROKEN
# define STD_COMPLEX_TESTS_STATIC_ASSERT(arg) static_assert(arg)
Expand Down Expand Up @@ -121,11 +122,8 @@ run_test()

namespace TestUtils
{
// This constant was declared to avoid the substitution and evaluation of the macro INFINITY
// inside Kernel code. Since the implementation of INFINITY macro is not regulated, there are
// cases where temporary expressions of type double are used to calculate the value of INFINITY.
// This lead to an error on devices where the double type is not supported.
static constexpr float infinity_val = INFINITY;
template <typename T>
static constexpr float infinity_val = std::numeric_limits<T>::infinity();

// Run test in Kernel as single task
template <typename TFncDoubleHasSupportInRuntime, typename TFncDoubleHasntSupportInRuntime>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ template <class T>
void
test()
{
test(dpl::complex<T>(TestUtils::infinity_val, 1), dpl::complex<T>(0, -TestUtils::infinity_val));
test(dpl::complex<T>(TestUtils::infinity_val<T>, 1), dpl::complex<T>(0, -TestUtils::infinity_val<T>));
}

void test_edges()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ template <class T>
void
test()
{
test(dpl::complex<T>(TestUtils::infinity_val, 1), dpl::complex<T>(TestUtils::infinity_val, 0));
test(dpl::complex<T>(TestUtils::infinity_val<T>, 1), dpl::complex<T>(TestUtils::infinity_val<T>, 0));
}

void test_edges()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ template <class T>
void
test()
{
test(dpl::complex<T>(0, 0), dpl::complex<T>(-TestUtils::infinity_val, 0));
test(dpl::complex<T>(0, 0), dpl::complex<T>(-TestUtils::infinity_val<T>, 0));
}

void test_edges()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ template <class T>
void
test()
{
test(dpl::complex<T>(0, 0), dpl::complex<T>(-TestUtils::infinity_val, 0));
test(dpl::complex<T>(0, 0), dpl::complex<T>(-TestUtils::infinity_val<T>, 0));
}

void test_edges()
Expand Down
Loading