Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Fix long double reference in cmath in device code paths #275

Merged
merged 4 commits into from
May 11, 2022
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
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,12 @@

#include "test_macros.h"


struct short_container {
__host__ __device__
uint16_t size() const { return 60000; } // not noexcept
};



template<typename C>
__host__ __device__
void test_container(C& c)
Expand Down Expand Up @@ -96,6 +94,7 @@ int main(int, char**)
#if defined(_LIBCUDACXX_HAS_VECTOR)
test_container ( v );
ASSERT_SAME_TYPE(ptrdiff_t, decltype(cuda::std::ssize(v)));
#endif
#if defined(_LIBCUDACXX_HAS_LIST)
test_container ( l );
ASSERT_SAME_TYPE(ptrdiff_t, decltype(cuda::std::ssize(l)));
Expand All @@ -107,6 +106,7 @@ int main(int, char**)

#if defined(_LIBCUDACXX_HAS_VECTOR)
test_const_container ( v );
#endif
#if defined(_LIBCUDACXX_HAS_LIST)
test_const_container ( l );
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ int main(int, char**)
// SFINAE-able underlying_type
#if TEST_STD_VER > 17
static_assert( has_type_member<E>::value, "");
#ifdef TEST_UNSIGNED_UNDERLYING_TYPE
static_assert( has_type_member<F>::value, "");
#endif // TEST_UNSIGNED_UNDERLYING_TYPE
static_assert( has_type_member<G>::value, "");

static_assert(!has_type_member<void>::value, "");
Expand Down
5 changes: 5 additions & 0 deletions include/cuda/std/detail/libcxx/include/cmath
Original file line number Diff line number Diff line change
Expand Up @@ -689,8 +689,13 @@ _LIBCUDACXX_CONSTEXPR _IntT __max_representable_int_for_float() _NOEXCEPT {
static_assert(is_floating_point<_FloatT>::value, "must be a floating point type");
static_assert(is_integral<_IntT>::value, "must be an integral type");
static_assert(numeric_limits<_FloatT>::radix == 2, "FloatT has incorrect radix");
#ifdef _LIBCUDACXX_HAS_COMPLEX_LONG_DOUBLE
static_assert((_IsSame<_FloatT, float>::value || _IsSame<_FloatT, double>::value
|| _IsSame<_FloatT,long double>::value), "unsupported floating point type");
#else
static_assert((_IsSame<_FloatT, float>::value || _IsSame<_FloatT, double>::value),
"unsupported floating point type");
#endif
return _FloatBigger ? numeric_limits<_IntT>::max() : (numeric_limits<_IntT>::max() >> _Bits << _Bits);
}

Expand Down