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

Backport #16038 to 24.06 #16101

Merged
merged 2 commits into from
Jul 1, 2024
Merged
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
13 changes: 12 additions & 1 deletion cpp/include/cudf/ast/detail/operators.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#include <cudf/ast/expressions.hpp>
#include <cudf/types.hpp>
#include <cudf/unary.hpp>
#include <cudf/utilities/error.hpp>
#include <cudf/utilities/type_dispatcher.hpp>

Expand Down Expand Up @@ -819,7 +820,17 @@ struct operator_functor<ast_operator::NOT, false> {
template <typename To>
struct cast {
static constexpr auto arity{1};
template <typename From>
template <typename From, typename std::enable_if_t<is_fixed_point<From>()>* = nullptr>
__device__ inline auto operator()(From f) -> To
{
if constexpr (cuda::std::is_floating_point_v<To>) {
return convert_fixed_to_floating<To>(f);
} else {
return static_cast<To>(f);
}
}

template <typename From, typename cuda::std::enable_if_t<!is_fixed_point<From>()>* = nullptr>
__device__ inline auto operator()(From f) -> decltype(static_cast<To>(f))
{
return static_cast<To>(f);
Expand Down
Loading