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

Commit

Permalink
Merge pull request #275 from NVIDIA/bugfix/msvc_complex_failures
Browse files Browse the repository at this point in the history
Fix long double reference in cmath in device code paths
  • Loading branch information
wmaxey committed May 11, 2022
2 parents 0edbb68 + 29245eb commit 768b2a3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
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

0 comments on commit 768b2a3

Please sign in to comment.