| 命名空间 | 类型定义 | 枚举 | 函数
fixed_point.hpp 文件参考

定点数据类型的类定义。 更多...

#include <cudf/detail/utilities/assert.cuh>
#include <cudf/fixed_point/temporary.hpp>
#include <cudf/types.hpp>
#include <cuda/std/limits>
#include <cuda/std/type_traits>
#include <cuda/std/utility>
#include <algorithm>
#include <cassert>
#include <cmath>
#include <string>

转到此文件的源代码。

结构体  numeric::scaled_integer< Rep, >
 用于在值已偏移时构造 fixed_point 的辅助结构体。 更多...
 
类  numeric::fixed_point< Rep, Rad >
 表示具有固定精度位数的数字的类型。 更多...
 

命名空间

 numeric
 fixed_point 和支持类型
 

类型定义

使用 numeric::decimal32 = fixed_point< int32_t, Radix::BASE_10 >
 32位十进制定点数
 
使用 numeric::decimal64 = fixed_point< int64_t, Radix::BASE_10 >
 64位十进制定点数
 
使用 numeric::decimal128 = fixed_point< __int128_t, Radix::BASE_10 >
 128位十进制定点数
 

枚举

枚举  numeric::scale_type : int32_t
 fixed_point 的比例类型。
 
枚举类  numeric::Radix : int32_t { BASE_2 = 2 , BASE_10 = 10 }
 构造 fixed_point 时使用的范围枚举器。 更多...
 

函数

template<typename T >
constexpr CUDF_HOST_DEVICE auto numeric::is_supported_representation_type ()
 如果表示类型受 fixed_point 支持,则返回 true。 更多...
 
constexpr CUDF_HOST_DEVICE scale_type numeric::detail::min (scale_type const &a, scale_type const &b)
 返回给定比例中较小的一个。 更多...
 
template<typename Rep , Radix Base, typename T , typename cuda::std::enable_if_t<(cuda::std::is_same_v< int32_t, T > &&cuda::std::is_integral_v< Rep >)> * = nullptr>
constexpr CUDF_HOST_DEVICE Rep numeric::detail::ipow (T exponent)
 用于通过平方进行整数幂运算的函数。 更多...
 
template<typename Rep , Radix Rad, typename T >
constexpr CUDF_HOST_DEVICEnumeric::detail::right_shift (T const &val, scale_type const &scale)
 val 执行“scale”次右移操作的函数。 更多...
 
template<typename Rep , Radix Rad, typename T >
constexpr CUDF_HOST_DEVICEnumeric::detail::left_shift (T const &val, scale_type const &scale)
 val 执行“scale”次左移操作的函数。 更多...
 
template<typename Rep , Radix Rad, typename T >
constexpr CUDF_HOST_DEVICEnumeric::detail::shift (T const &val, scale_type const &scale)
 val 执行“scale”次右移左移操作的函数。 更多...
 
template<typename Rep , typename T >
CUDF_HOST_DEVICE auto numeric::addition_overflow (T lhs, T rhs)
 用于在加法时识别整数溢出的函数。 更多...
 
template<typename Rep , typename T >
CUDF_HOST_DEVICE auto numeric::subtraction_overflow (T lhs, T rhs)
 用于在减法时识别整数溢出的函数。 更多...
 
template<typename Rep , typename T >
CUDF_HOST_DEVICE auto numeric::division_overflow (T lhs, T rhs)
 用于在除法时识别整数溢出的函数。 更多...
 
template<typename Rep , typename T >
CUDF_HOST_DEVICE auto numeric::multiplication_overflow (T lhs, T rhs)
 用于在乘法时识别整数溢出的函数。 更多...
 
template<typename Rep1 , Radix Rad1>
CUDF_HOST_DEVICE fixed_point< Rep1, Rad1 > numeric::operator+ (fixed_point< Rep1, Rad1 > const &lhs, fixed_point< Rep1, Rad1 > const &rhs)
 
template<typename Rep1 , Radix Rad1>
CUDF_HOST_DEVICE fixed_point< Rep1, Rad1 > numeric::operator- (fixed_point< Rep1, Rad1 > const &lhs, fixed_point< Rep1, Rad1 > const &rhs)
 
template<typename Rep1 , Radix Rad1>
CUDF_HOST_DEVICE fixed_point< Rep1, Rad1 > numeric::operator* (fixed_point< Rep1, Rad1 > const &lhs, fixed_point< Rep1, Rad1 > const &rhs)
 
template<typename Rep1 , Radix Rad1>
CUDF_HOST_DEVICE fixed_point< Rep1, Rad1 > numeric::operator/ (fixed_point< Rep1, Rad1 > const &lhs, fixed_point< Rep1, Rad1 > const &rhs)
 
template<typename Rep1 , Radix Rad1>
CUDF_HOST_DEVICE bool numeric::operator== (fixed_point< Rep1, Rad1 > const &lhs, fixed_point< Rep1, Rad1 > const &rhs)
 
template<typename Rep1 , Radix Rad1>
CUDF_HOST_DEVICE bool numeric::operator!= (fixed_point< Rep1, Rad1 > const &lhs, fixed_point< Rep1, Rad1 > const &rhs)
 
template<typename Rep1 , Radix Rad1>
CUDF_HOST_DEVICE bool numeric::operator<= (fixed_point< Rep1, Rad1 > const &lhs, fixed_point< Rep1, Rad1 > const &rhs)
 
template<typename Rep1 , Radix Rad1>
CUDF_HOST_DEVICE bool numeric::operator>= (fixed_point< Rep1, Rad1 > const &lhs, fixed_point< Rep1, Rad1 > const &rhs)
 
template<typename Rep1 , Radix Rad1>
CUDF_HOST_DEVICE bool numeric::operator< (fixed_point< Rep1, Rad1 > const &lhs, fixed_point< Rep1, Rad1 > const &rhs)
 
template<typename Rep1 , Radix Rad1>
CUDF_HOST_DEVICE bool numeric::operator> (fixed_point< Rep1, Rad1 > const &lhs, fixed_point< Rep1, Rad1 > const &rhs)
 
template<typename Rep1 , Radix Rad1>
CUDF_HOST_DEVICE fixed_point< Rep1, Rad1 > numeric::operator% (fixed_point< Rep1, Rad1 > const &lhs, fixed_point< Rep1, Rad1 > const &rhs)
 

详细说明

定点数据类型的类定义。

定义在文件 fixed_point.hpp 中。

函数文档

◆ ipow()

template<typename Rep , Radix Base, typename T , typename cuda::std::enable_if_t<(cuda::std::is_same_v< int32_t, T > &&cuda::std::is_integral_v< Rep >)> * = nullptr>
constexpr CUDF_HOST_DEVICE Rep numeric::detail::ipow ( exponent)
inlineconstexpr

用于通过平方进行整数幂运算的函数。

模板参数
Rep返回类型的表示类型
Base待幂运算的底数
参数
exponent用于幂运算的指数
返回值
Base 的 exponent 次幂的结果,类型为 Rep

定义在文件 fixed_point.hpp 的第 106 行。

◆ left_shift()

template<typename Rep , Radix Rad, typename T >
constexpr CUDF_HOST_DEVICE T numeric::detail::left_shift ( T const &  val,
scale_type const &  scale 
)
inlineconstexpr

val 执行“scale”次左移操作的函数。

注意:当使用负比例构造时执行此操作

模板参数
Rep整数幂运算所需的表示类型
Rad在幂运算中充当底数的基数
T正在被移动的值 val 的类型以及返回类型
参数
val正在被移动的值
scale移动值的量
返回值
类型为 T 的移位后的值

定义在文件 fixed_point.hpp 的第 156 行。

◆ min()

constexpr CUDF_HOST_DEVICE scale_type numeric::detail::min ( scale_type const &  a,
scale_type const &  b 
)
inlineconstexpr

返回给定比例中较小的一个。

参数
a左侧用于比较的值
b右侧用于比较的值
返回值
给定比例中较小的一个

定义在文件 fixed_point.hpp 的第 82 行。

◆ right_shift()

template<typename Rep , Radix Rad, typename T >
constexpr CUDF_HOST_DEVICE T numeric::detail::right_shift ( T const &  val,
scale_type const &  scale 
)
inlineconstexpr

val 执行“scale”次右移操作的函数。

注意:当使用正比例构造时执行此操作

模板参数
Rep整数幂运算所需的表示类型
Rad在幂运算中充当底数的基数
T正在被移动的值 val 的类型以及返回类型
参数
val正在被移动的值
scale移动值的量
返回值
类型为 T 的移位后的值

定义在文件 fixed_point.hpp 的第 139 行。

◆ shift()

template<typename Rep , Radix Rad, typename T >
constexpr CUDF_HOST_DEVICE T numeric::detail::shift ( T const &  val,
scale_type const &  scale 
)
inlineconstexpr

val 执行“scale”次右移左移操作的函数。

注意:函数将根据 val 的符号调用正确的右移或左移。

模板参数
Rep整数幂运算所需的表示类型
Rad在幂运算中充当底数的基数
T正在被移动的值 val 的类型以及返回类型
参数
val正在被移动的值
scale移动值的量
返回值
类型为 T 的移位后的值

定义在文件 fixed_point.hpp 的第 175 行。