|
template<typename T , typename cuda::std::enable_if_t< cuda::std::is_floating_point< T >() &&is_supported_representation_type< Rep >()> * = nullptr> |
CUDF_HOST_DEVICE | fixed_point (T const &value, scale_type const &scale) |
| Constructor that will perform shifting to store value appropriately (from floating point types) More...
|
|
template<typename T , typename cuda::std::enable_if_t< cuda::std::is_integral< T >() &&is_supported_representation_type< Rep >()> * = nullptr> |
CUDF_HOST_DEVICE | fixed_point (T const &value, scale_type const &scale) |
| Constructor that will perform shifting to store value appropriately (from integral types) More...
|
|
CUDF_HOST_DEVICE | fixed_point (scaled_integer< Rep > s) |
| Constructor that will not perform shifting (assumes value already shifted) More...
|
|
template<typename T , typename cuda::std::enable_if_t< is_supported_construction_value_type< T >()> * = nullptr> |
CUDF_HOST_DEVICE | fixed_point (T const &value) |
| "Scale-less" constructor that constructs fixed_point number with a specified value and scale of zero More...
|
|
CUDF_HOST_DEVICE | fixed_point () |
| Default constructor that constructs fixed_point number with a value and scale of zero.
|
|
template<typename U , typename cuda::std::enable_if_t< cuda::std::is_floating_point_v< U >> * = nullptr> |
constexpr | operator U () const |
| Explicit conversion operator for casting to floating point types. More...
|
|
template<typename U , typename cuda::std::enable_if_t< cuda::std::is_integral_v< U >> * = nullptr> |
constexpr | operator U () const |
| Explicit conversion operator for casting to integral types. More...
|
|
CUDF_HOST_DEVICE | operator scaled_integer< Rep > () const |
| Converts the fixed_point number to a scaled_integer More...
|
|
CUDF_HOST_DEVICE rep | value () const |
| Method that returns the underlying value of the fixed_point number. More...
|
|
CUDF_HOST_DEVICE scale_type | scale () const |
| Method that returns the scale of the fixed_point number. More...
|
|
constexpr CUDF_HOST_DEVICE | operator bool () const |
| Explicit conversion operator to bool More...
|
|
template<typename Rep1 , Radix Rad1> |
CUDF_HOST_DEVICE fixed_point< Rep1, Rad1 > & | operator+= (fixed_point< Rep1, Rad1 > const &rhs) |
| operator += More...
|
|
template<typename Rep1 , Radix Rad1> |
CUDF_HOST_DEVICE fixed_point< Rep1, Rad1 > & | operator*= (fixed_point< Rep1, Rad1 > const &rhs) |
| operator *= More...
|
|
template<typename Rep1 , Radix Rad1> |
CUDF_HOST_DEVICE fixed_point< Rep1, Rad1 > & | operator-= (fixed_point< Rep1, Rad1 > const &rhs) |
| operator -= More...
|
|
template<typename Rep1 , Radix Rad1> |
CUDF_HOST_DEVICE fixed_point< Rep1, Rad1 > & | operator/= (fixed_point< Rep1, Rad1 > const &rhs) |
| operator /= More...
|
|
CUDF_HOST_DEVICE fixed_point< Rep, Rad > & | operator++ () |
| operator ++ (post-increment) More...
|
|
CUDF_HOST_DEVICE fixed_point< Rep, Rad > | rescaled (scale_type scale) const |
| Method for creating a fixed_point number with a new scale More...
|
|
| operator std::string () const |
| Returns a string representation of the fixed_point value.
|
|
|
template<typename Rep1 , Radix Rad1> |
CUDF_HOST_DEVICE friend fixed_point< Rep1, Rad1 > | operator+ (fixed_point< Rep1, Rad1 > const &lhs, fixed_point< Rep1, Rad1 > const &rhs) |
| operator + (for adding two fixed_point numbers) More...
|
|
template<typename Rep1 , Radix Rad1> |
CUDF_HOST_DEVICE friend fixed_point< Rep1, Rad1 > | operator- (fixed_point< Rep1, Rad1 > const &lhs, fixed_point< Rep1, Rad1 > const &rhs) |
| operator - (for subtracting two fixed_point numbers) More...
|
|
template<typename Rep1 , Radix Rad1> |
CUDF_HOST_DEVICE friend fixed_point< Rep1, Rad1 > | operator* (fixed_point< Rep1, Rad1 > const &lhs, fixed_point< Rep1, Rad1 > const &rhs) |
| operator * (for multiplying two fixed_point numbers) More...
|
|
template<typename Rep1 , Radix Rad1> |
CUDF_HOST_DEVICE friend fixed_point< Rep1, Rad1 > | operator/ (fixed_point< Rep1, Rad1 > const &lhs, fixed_point< Rep1, Rad1 > const &rhs) |
| operator / (for dividing two fixed_point numbers) More...
|
|
template<typename Rep1 , Radix Rad1> |
CUDF_HOST_DEVICE friend fixed_point< Rep1, Rad1 > | operator% (fixed_point< Rep1, Rad1 > const &lhs, fixed_point< Rep1, Rad1 > const &rhs) |
| operator % (for computing the modulo operation of two fixed_point numbers) More...
|
|
template<typename Rep1 , Radix Rad1> |
CUDF_HOST_DEVICE friend bool | operator== (fixed_point< Rep1, Rad1 > const &lhs, fixed_point< Rep1, Rad1 > const &rhs) |
| operator == (for comparing two fixed_point numbers) More...
|
|
template<typename Rep1 , Radix Rad1> |
CUDF_HOST_DEVICE friend bool | operator!= (fixed_point< Rep1, Rad1 > const &lhs, fixed_point< Rep1, Rad1 > const &rhs) |
| operator != (for comparing two fixed_point numbers) More...
|
|
template<typename Rep1 , Radix Rad1> |
CUDF_HOST_DEVICE friend bool | operator<= (fixed_point< Rep1, Rad1 > const &lhs, fixed_point< Rep1, Rad1 > const &rhs) |
| operator <= (for comparing two fixed_point numbers) More...
|
|
template<typename Rep1 , Radix Rad1> |
CUDF_HOST_DEVICE friend bool | operator>= (fixed_point< Rep1, Rad1 > const &lhs, fixed_point< Rep1, Rad1 > const &rhs) |
| operator >= (for comparing two fixed_point numbers) More...
|
|
template<typename Rep1 , Radix Rad1> |
CUDF_HOST_DEVICE friend bool | operator< (fixed_point< Rep1, Rad1 > const &lhs, fixed_point< Rep1, Rad1 > const &rhs) |
| operator < (for comparing two fixed_point numbers) More...
|
|
template<typename Rep1 , Radix Rad1> |
CUDF_HOST_DEVICE friend bool | operator> (fixed_point< Rep1, Rad1 > const &lhs, fixed_point< Rep1, Rad1 > const &rhs) |
| operator > (for comparing two fixed_point numbers) More...
|
|
template<typename Rep, Radix Rad>
class numeric::fixed_point< Rep, Rad >
A type for representing a number with a fixed amount of precision.
Currently, only binary and decimal fixed_point
numbers are supported. Binary operations can only be performed with other fixed_point
numbers
- Template Parameters
-
Rep | The representation type (either int32_t or int64_t ) |
Rad | The radix/base (either Radix::BASE_2 or Radix::BASE_10 ) |
Definition at line 219 of file fixed_point.hpp.
template<typename Rep , Radix Rad>
template<typename Rep1 , Radix Rad1>
operator != (for comparing two fixed_point
numbers)
If _scale
s are equal, _value
s are compared. If _scale
s are not equal, the number with the larger _scale
is shifted to the smaller _scale
, and then the _value
s are compared.
- Template Parameters
-
Rep1 | Representation type of the operand lhs and rhs |
Rad1 | Radix (base) type of the operand lhs and rhs |
- Parameters
-
lhs | The left hand side operand |
rhs | The right hand side operand |
- Returns
- true if
lhs
and rhs
are not equal, false if not
Definition at line 784 of file fixed_point.hpp.
template<typename Rep , Radix Rad>
template<typename Rep1 , Radix Rad1>
operator % (for computing the modulo operation of two fixed_point
numbers)
If _scale
s are equal, the modulus is computed directly. If _scale
s are not equal, the number with larger _scale
is shifted to the smaller _scale
, and then the modulus is computed.
- Template Parameters
-
Rep1 | Representation type of the operand lhs and rhs |
Rad1 | Radix (base) type of the operand lhs and rhs |
- Parameters
-
lhs | The left hand side operand |
rhs | The right hand side operand |
- Returns
- The resulting
fixed_point
number
Definition at line 829 of file fixed_point.hpp.
template<typename Rep , Radix Rad>
template<typename Rep1 , Radix Rad1>
operator + (for adding two fixed_point
numbers)
If _scale
s are equal, _value
s are added. If _scale
s are not equal, the number with the larger _scale
is shifted to the smaller _scale
, and then the _value
s are added.
- Template Parameters
-
Rep1 | Representation type of the operand lhs and rhs |
Rad1 | Radix (base) type of the operand lhs and rhs |
- Parameters
-
lhs | The left hand side operand |
rhs | The right hand side operand |
- Returns
- The resulting
fixed_point
sum
Definition at line 709 of file fixed_point.hpp.
template<typename Rep , Radix Rad>
template<typename Rep1 , Radix Rad1>
operator - (for subtracting two fixed_point
numbers)
If _scale
s are equal, _value
s are subtracted. If _scale
s are not equal, the number with the larger _scale
is shifted to the smaller _scale
, and then the _value
s are subtracted.
- Template Parameters
-
Rep1 | Representation type of the operand lhs and rhs |
Rad1 | Radix (base) type of the operand lhs and rhs |
- Parameters
-
lhs | The left hand side operand |
rhs | The right hand side operand |
- Returns
- The resulting
fixed_point
difference
Definition at line 727 of file fixed_point.hpp.
template<typename Rep , Radix Rad>
template<typename Rep1 , Radix Rad1>
operator < (for comparing two fixed_point
numbers)
If _scale
s are equal, _value
s are compared. If _scale
s are not equal, the number with the larger _scale
is shifted to the smaller _scale
, and then the _value
s are compared.
- Template Parameters
-
Rep1 | Representation type of the operand lhs and rhs |
Rad1 | Radix (base) type of the operand lhs and rhs |
- Parameters
-
lhs | The left hand side operand |
rhs | The right hand side operand |
- Returns
- true if
lhs
less than rhs
, false if not
Definition at line 811 of file fixed_point.hpp.
template<typename Rep , Radix Rad>
template<typename Rep1 , Radix Rad1>
operator <= (for comparing two fixed_point
numbers)
If _scale
s are equal, _value
s are compared. If _scale
s are not equal, the number with the larger _scale
is shifted to the smaller _scale
, and then the _value
s are compared.
- Template Parameters
-
Rep1 | Representation type of the operand lhs and rhs |
Rad1 | Radix (base) type of the operand lhs and rhs |
- Parameters
-
lhs | The left hand side operand |
rhs | The right hand side operand |
- Returns
- true if
lhs
less than or equal to rhs
, false if not
Definition at line 793 of file fixed_point.hpp.
template<typename Rep , Radix Rad>
template<typename Rep1 , Radix Rad1>
operator == (for comparing two fixed_point
numbers)
If _scale
s are equal, _value
s are compared. If _scale
s are not equal, the number with the larger _scale
is shifted to the smaller _scale
, and then the _value
s are compared.
- Template Parameters
-
Rep1 | Representation type of the operand lhs and rhs |
Rad1 | Radix (base) type of the operand lhs and rhs |
- Parameters
-
lhs | The left hand side operand |
rhs | The right hand side operand |
- Returns
- true if
lhs
and rhs
are equal, false if not
Definition at line 775 of file fixed_point.hpp.
template<typename Rep , Radix Rad>
template<typename Rep1 , Radix Rad1>
operator > (for comparing two fixed_point
numbers)
If _scale
s are equal, _value
s are compared. If _scale
s are not equal, the number with the larger _scale
is shifted to the smaller _scale
, and then the _value
s are compared.
- Template Parameters
-
Rep1 | Representation type of the operand lhs and rhs |
Rad1 | Radix (base) type of the operand lhs and rhs |
- Parameters
-
lhs | The left hand side operand |
rhs | The right hand side operand |
- Returns
- true if
lhs
greater than rhs
, false if not
Definition at line 820 of file fixed_point.hpp.
template<typename Rep , Radix Rad>
template<typename Rep1 , Radix Rad1>
operator >= (for comparing two fixed_point
numbers)
If _scale
s are equal, _value
s are compared. If _scale
s are not equal, the number with the larger _scale
is shifted to the smaller _scale
, and then the _value
s are compared.
- Template Parameters
-
Rep1 | Representation type of the operand lhs and rhs |
Rad1 | Radix (base) type of the operand lhs and rhs |
- Parameters
-
lhs | The left hand side operand |
rhs | The right hand side operand |
- Returns
- true if
lhs
greater than or equal to rhs
, false if not
Definition at line 802 of file fixed_point.hpp.