diff --git a/cpp/src/strings/convert/utilities.cuh b/cpp/src/strings/convert/utilities.cuh index 234ecf48f2e..d9ca8159706 100644 --- a/cpp/src/strings/convert/utilities.cuh +++ b/cpp/src/strings/convert/utilities.cuh @@ -67,8 +67,9 @@ __device__ inline size_type integer_to_string(IntegerType value, char* d_buffer) bool const is_negative = cuda::std::is_signed() ? (value < 0) : false; constexpr IntegerType base = 10; - constexpr int MAX_DIGITS = 20; // largest 64-bit integer is 20 digits - char digits[MAX_DIGITS]; // place-holder for digit chars + // largest 64-bit integer is 20 digits; largest 128-bit integer is 39 digits + constexpr int MAX_DIGITS = cuda::std::numeric_limits::digits10 + 1; + char digits[MAX_DIGITS]; // place-holder for digit chars int digits_idx = 0; while (value != 0) { assert(digits_idx < MAX_DIGITS); @@ -107,7 +108,7 @@ constexpr size_type count_digits(IntegerType value) auto const digits = [value] { // largest 8-byte unsigned value is 18446744073709551615 (20 digits) // largest 16-byte unsigned value is 340282366920938463463374607431768211455 (39 digits) - auto constexpr max_digits = std::is_same_v ? 39 : 20; + auto constexpr max_digits = cuda::std::numeric_limits::digits10 + 1; size_type digits = 1; __int128_t pow10 = 10; diff --git a/cpp/tests/strings/fixed_point_tests.cpp b/cpp/tests/strings/fixed_point_tests.cpp index 7c188d39f6f..ce4280e0733 100644 --- a/cpp/tests/strings/fixed_point_tests.cpp +++ b/cpp/tests/strings/fixed_point_tests.cpp @@ -303,7 +303,11 @@ TEST_F(StringsConvertTest, IsFixedPoint) CUDF_TEST_EXPECT_COLUMNS_EQUIVALENT(*results, expected64_scaled); } +#ifdef NDEBUG TEST_F(StringsConvertTest, FixedPointStringConversionOperator) +#else +TEST_F(StringsConvertTest, DISABLED_FixedPointStringConversionOperator) +#endif { auto const max = cuda::std::numeric_limits<__int128_t>::max();