Skip to content

Commit

Permalink
Fix decimal -> float cast in ast code (#16038)
Browse files Browse the repository at this point in the history
Fix decimal -> float cast in ast code that was missed during the earlier code refactoring for making the cast explicit.  

This closes [issue 16023](#16023)

Authors:
  - Paul Mattione (https://github.com/pmattione-nvidia)

Approvers:
  - Muhammad Haseeb (https://github.com/mhaseeb123)
  - Bradley Dice (https://github.com/bdice)

URL: #16038
  • Loading branch information
pmattione-nvidia authored Jun 14, 2024
1 parent 2ad502e commit 74b3826
Showing 1 changed file with 12 additions and 1 deletion.
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

0 comments on commit 74b3826

Please sign in to comment.