23 #include <cudf/utilities/export.hpp>
29 namespace CUDF_EXPORT
cudf {
51 template <
typename Fixed,
53 CUDF_ENABLE_IF(cuda::std::is_floating_point_v<Floating>&& is_fixed_point<Fixed>())>
56 using Rep =
typename Fixed::rep;
57 auto const value = [&]() {
58 if constexpr (Fixed::rad == numeric::Radix::BASE_10) {
59 return numeric::detail::convert_floating_to_integral<Rep>(floating, scale);
61 return static_cast<Rep
>(numeric::detail::shift<Rep, Fixed::rad>(floating, scale));
81 template <
typename Floating,
83 CUDF_ENABLE_IF(cuda::std::is_floating_point_v<Floating>&& is_fixed_point<Fixed>())>
86 using Rep =
typename Fixed::rep;
87 if constexpr (Fixed::rad == numeric::Radix::BASE_10) {
88 return numeric::detail::convert_integral_to_floating<Floating>(fixed.value(), fixed.scale());
90 auto const casted =
static_cast<Floating
>(fixed.value());
92 return numeric::detail::shift<Rep, Fixed::rad>(casted, scale);
104 template <
typename Floating,
109 if constexpr (is_fixed_point<Input>()) {
110 return convert_fixed_to_floating<Floating>(input);
112 return static_cast<Floating
>(input);
A non-owning, immutable view of device data as a column of elements, some of which may be null as ind...
Indicator for the logical data type of an element in a column.
Class definition for fixed point data type.
fixed_point <--> floating-point conversion functions.
rmm::cuda_stream_view const get_default_stream()
Get the current default stream.
scale_type
The scale type for fixed_point.
rmm::device_async_resource_ref get_current_device_resource_ref()
Get the current device memory resource reference.
cuda::mr::async_resource_ref< cuda::mr::device_accessible > device_async_resource_ref
#define CUDF_ENABLE_IF(...)
Convenience macro for SFINAE as an unnamed template parameter.
Helper struct for constructing fixed_point when value is already shifted.
Type declarations for libcudf.
#define CUDF_HOST_DEVICE
Indicates that the function or method is usable on host and device.