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 scale_type = strong_typedef< int32_t >
 
using decimal32 = fixed_point< int32_t, Radix::BASE_10 >
 
using decimal64 = fixed_point< int64_t, Radix::BASE_10 >
 

Enumerations

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 ()
 
template<typename T >
constexpr auto is_supported_construction_value_type ()
 
template<typename Rep , typename T >
CUDA_HOST_DEVICE_CALLABLE auto addition_overflow (T lhs, T rhs)
 Function for identifying integer overflow when adding. More...
 
template<typename Rep , typename T >
CUDA_HOST_DEVICE_CALLABLE auto subtraction_overflow (T lhs, T rhs)
 Function for identifying integer overflow when subtracting. More...
 
template<typename Rep , typename T >
CUDA_HOST_DEVICE_CALLABLE auto division_overflow (T lhs, T rhs)
 Function for identifying integer overflow when dividing. More...
 
template<typename Rep , typename T >
CUDA_HOST_DEVICE_CALLABLE auto multiplication_overflow (T lhs, T rhs)
 Function for identifying integer overflow when multiplying. More...
 
template<typename Rep1 , Radix Rad1>
CUDA_HOST_DEVICE_CALLABLE fixed_point< Rep1, Rad1 > operator+ (fixed_point< Rep1, Rad1 > const &lhs, fixed_point< Rep1, Rad1 > const &rhs)
 
template<typename Rep1 , Radix Rad1>
CUDA_HOST_DEVICE_CALLABLE fixed_point< Rep1, Rad1 > operator- (fixed_point< Rep1, Rad1 > const &lhs, fixed_point< Rep1, Rad1 > const &rhs)
 
template<typename Rep1 , Radix Rad1>
CUDA_HOST_DEVICE_CALLABLE fixed_point< Rep1, Rad1 > operator* (fixed_point< Rep1, Rad1 > const &lhs, fixed_point< Rep1, Rad1 > const &rhs)
 
template<typename Rep1 , Radix Rad1>
CUDA_HOST_DEVICE_CALLABLE fixed_point< Rep1, Rad1 > operator/ (fixed_point< Rep1, Rad1 > const &lhs, fixed_point< Rep1, Rad1 > const &rhs)
 
template<typename Rep1 , Radix Rad1>
CUDA_HOST_DEVICE_CALLABLE bool operator== (fixed_point< Rep1, Rad1 > const &lhs, fixed_point< Rep1, Rad1 > const &rhs)
 
template<typename Rep1 , Radix Rad1>
CUDA_HOST_DEVICE_CALLABLE bool operator!= (fixed_point< Rep1, Rad1 > const &lhs, fixed_point< Rep1, Rad1 > const &rhs)
 
template<typename Rep1 , Radix Rad1>
CUDA_HOST_DEVICE_CALLABLE bool operator<= (fixed_point< Rep1, Rad1 > const &lhs, fixed_point< Rep1, Rad1 > const &rhs)
 
template<typename Rep1 , Radix Rad1>
CUDA_HOST_DEVICE_CALLABLE bool operator>= (fixed_point< Rep1, Rad1 > const &lhs, fixed_point< Rep1, Rad1 > const &rhs)
 
template<typename Rep1 , Radix Rad1>
CUDA_HOST_DEVICE_CALLABLE bool operator< (fixed_point< Rep1, Rad1 > const &lhs, fixed_point< Rep1, Rad1 > const &rhs)
 
template<typename Rep1 , Radix Rad1>
CUDA_HOST_DEVICE_CALLABLE bool 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 58 of file fixed_point.hpp.