23 #include <cudf/utilities/export.hpp>
31 namespace CUDF_EXPORT
cudf {
53 template <
typename Fixed,
55 CUDF_ENABLE_IF(cuda::std::is_floating_point_v<Floating>&& is_fixed_point<Fixed>())>
58 using Rep =
typename Fixed::rep;
59 auto const value = [&]() {
60 if constexpr (Fixed::rad == numeric::Radix::BASE_10) {
61 return numeric::detail::convert_floating_to_integral<Rep>(floating, scale);
63 return static_cast<Rep
>(numeric::detail::shift<Rep, Fixed::rad>(floating, scale));
83 template <
typename Floating,
85 CUDF_ENABLE_IF(cuda::std::is_floating_point_v<Floating>&& is_fixed_point<Fixed>())>
88 using Rep =
typename Fixed::rep;
89 if constexpr (Fixed::rad == numeric::Radix::BASE_10) {
90 return numeric::detail::convert_integral_to_floating<Floating>(fixed.value(), fixed.scale());
92 auto const casted =
static_cast<Floating
>(fixed.value());
94 return numeric::detail::shift<Rep, Fixed::rad>(casted, scale);
106 template <
typename Floating,
111 if constexpr (is_fixed_point<Input>()) {
112 return convert_fixed_to_floating<Floating>(input);
114 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.
cuda::mr::async_resource_ref< cuda::mr::device_accessible > device_async_resource_ref
device_memory_resource * get_current_device_resource()
#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.