Classes | Typedefs | Enumerations | Functions
numeric Namespace Reference

fixed_point and supporting types More...

Classes

class  fixed_point
 A type for representing a number with a fixed amount of precision. More...
 
struct  scaled_integer
 Helper struct for constructing fixed_point when value is already shifted. More...
 

Typedefs

using decimal32 = fixed_point< int32_t, Radix::BASE_10 >
 32-bit decimal fixed point
 
using decimal64 = fixed_point< int64_t, Radix::BASE_10 >
 64-bit decimal fixed point
 
using decimal128 = fixed_point< __int128_t, Radix::BASE_10 >
 128-bit decimal fixed point
 

Enumerations

enum  scale_type : int32_t
 The scale type for fixed_point.
 
enum  Radix : int32_t { BASE_2 = 2, BASE_10 = 10 }
 Scoped enumerator to use when constructing fixed_point More...
 

Functions

template<typename T >
constexpr auto is_supported_representation_type ()
 Returns true if the representation type is supported by fixed_point More...
 
template<typename T >
constexpr auto is_supported_construction_value_type ()
 Returns true if the value type is supported for constructing a fixed_point More...
 
template<typename Rep , typename T >
CUDF_HOST_DEVICE auto addition_overflow (T lhs, T rhs)
 Function for identifying integer overflow when adding. More...
 
template<typename Rep , typename T >
CUDF_HOST_DEVICE auto subtraction_overflow (T lhs, T rhs)
 Function for identifying integer overflow when subtracting. More...
 
template<typename Rep , typename T >
CUDF_HOST_DEVICE auto division_overflow (T lhs, T rhs)
 Function for identifying integer overflow when dividing. More...
 
template<typename Rep , typename T >
CUDF_HOST_DEVICE auto multiplication_overflow (T lhs, T rhs)
 Function for identifying integer overflow when multiplying. More...
 
template<typename Rep1 , Radix Rad1>
CUDF_HOST_DEVICE fixed_point< Rep1, Rad1 > 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 > 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 > 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 > operator/ (fixed_point< Rep1, Rad1 > const &lhs, fixed_point< Rep1, Rad1 > const &rhs)
 
template<typename Rep1 , Radix Rad1>
CUDF_HOST_DEVICE bool operator== (fixed_point< Rep1, Rad1 > const &lhs, fixed_point< Rep1, Rad1 > const &rhs)
 
template<typename Rep1 , Radix Rad1>
CUDF_HOST_DEVICE bool operator!= (fixed_point< Rep1, Rad1 > const &lhs, fixed_point< Rep1, Rad1 > const &rhs)
 
template<typename Rep1 , Radix Rad1>
CUDF_HOST_DEVICE bool operator<= (fixed_point< Rep1, Rad1 > const &lhs, fixed_point< Rep1, Rad1 > const &rhs)
 
template<typename Rep1 , Radix Rad1>
CUDF_HOST_DEVICE bool operator>= (fixed_point< Rep1, Rad1 > const &lhs, fixed_point< Rep1, Rad1 > const &rhs)
 
template<typename Rep1 , Radix Rad1>
CUDF_HOST_DEVICE bool operator< (fixed_point< Rep1, Rad1 > const &lhs, fixed_point< Rep1, Rad1 > const &rhs)
 
template<typename Rep1 , Radix Rad1>
CUDF_HOST_DEVICE bool 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 > operator% (fixed_point< Rep1, Rad1 > const &lhs, fixed_point< Rep1, Rad1 > const &rhs)
 

Detailed Description

fixed_point and supporting types

Enumeration Type Documentation

◆ Radix

enum numeric::Radix : int32_t
strong

Scoped enumerator to use when constructing fixed_point

Examples:

using decimal32 = fixed_point<int32_t, Radix::BASE_10>;
using binary64 = fixed_point<int64_t, Radix::BASE_2>;

Definition at line 49 of file fixed_point.hpp.

Function Documentation

◆ is_supported_construction_value_type()

template<typename T >
constexpr auto numeric::is_supported_construction_value_type ( )
inlineconstexpr

Returns true if the value type is supported for constructing a fixed_point

Template Parameters
TThe construction value type
Returns
true if the value type is supported to construct a fixed_point type

Definition at line 72 of file fixed_point.hpp.

◆ is_supported_representation_type()

template<typename T >
constexpr auto numeric::is_supported_representation_type ( )
inlineconstexpr

Returns true if the representation type is supported by fixed_point

Template Parameters
TThe representation type
Returns
true if the type is supported by fixed_point implementation

Definition at line 58 of file fixed_point.hpp.

numeric::decimal32
fixed_point< int32_t, Radix::BASE_10 > decimal32
32-bit decimal fixed point
Definition: fixed_point.hpp:831