Class List > eosio :: fixed_point64
64 bits representation of Fixed Point class. More...
Public Attributes
Type | Name |
---|---|
int64_t | val Value of the fixed point represented as int64_t. |
Public Functions
Type | Name |
---|---|
fixed_point64 (int64_t v = 0) Construct a new fixed point64 object. |
|
fixed_point64 (const fixed_point64< QR > & r) Construct a new fixed point64 object from another fixed_point64. |
|
fixed_point64 (const fixed_point32< QR > & r) Construct a new fixed point64 object from another fixed_point32. |
|
int64_t | int_part () const To get the integer part of the fixed number. |
uint64_t | frac_part () const To get the decimal part of the fixed number. |
void | print () const Prints the fixed point value. |
fixed_point64 & | operator= (const fixed_point32< QR > & r) Assignment operator. |
fixed_point64 & | operator= (const fixed_point64< QR > & r) Assignment operator. |
fixed_point64<(Q >QR)?Q:QR > | operator+ (const fixed_point64< QR > & r) const Addition operator. |
fixed_point64<(Q >QR)?Q:QR > | operator- (const fixed_point64< QR > & r) const Subtraction operator. |
fixed_point128< Q+QR > | operator* (const fixed_point64< QR > & r) const Multiplication operator. |
fixed_point128< Q+64-QR > | operator/ (const fixed_point64< QR > & r) const Division operator. |
bool | operator== (const fixed_point64< QR > & r) Equality operator. |
bool | operator> (const fixed_point64< QR > & r) Greater than operator. |
bool | operator< (const fixed_point64< QR > & r) Less than operator. |
fixed_point64<(Q >QR)?Q:QR > | operator+ (const fixed_point64< QR > & rhs) const Addition between two fixed_point64 variables and the result goes to fixed_point64. |
fixed_point64<(Q >QR)?Q:QR > | operator- (const fixed_point64< QR > & rhs) const Subtraction between two fixed_point64 variables and the result goes to fixed_point64. |
Detailed Description
Example:
fixed_point64<6> a(123232.455667233)
fixed_point64<0> a(123424)
fixed_point64<18> c = a*b;
fixed_point64<24> d = a+b+c;
fixed_point64<24> e = b/a;
Public Attributes Documentation
variable val
int64_t eosio::fixed_point64< Q >::val;
Value of the fixed point represented as int64_t.
Value of the fixed point represented as int64_t
Public Functions Documentation
function fixed_point64 (1/3)
eosio::fixed_point64< Q >::fixed_point64(
int64_t v = 0
)
Construct a new fixed point64 object.
Construct a new fixed point64 object from int64_t
Parameters:
- v - int64_t representation of the fixed point value
function fixed_point64 (2/3)
template<uint8_t QR>
eosio::fixed_point64< Q >::fixed_point64(
const fixed_point64< QR > & r
)
Construct a new fixed point64 object from another fixed_point64.
Construct a new fixed point64 object from another fixed_point64
Parameters:
- r - Another fixed_point64 as source
function fixed_point64 (3/3)
template<uint8_t QR>
eosio::fixed_point64< Q >::fixed_point64(
const fixed_point32< QR > & r
)
Construct a new fixed point64 object from another fixed_point32.
Construct a new fixed point64 object from another fixed_point32
Parameters:
- r - fixed_point64 as source
function int_part
int64_t eosio::fixed_point64< Q >::int_part() const
To get the integer part of the fixed number.
Get the integer part of the 64 bit fixed number
Returns:
Returns integer part of the fixed number
Example:
fixed_point64<18> a(1234.455667)
std::cout << a.int_part(); // Output: 1234
function frac_part
uint64_t eosio::fixed_point64< Q >::frac_part() const
To get the decimal part of the fixed number.
Get the decimal part of the 64 bit fixed number
Returns:
Returns decimal part of the fixed number
Example:
fixed64<3> a(1234.455667)
std::cout << a.decimal_part(); // Output: 455
function print
void eosio::fixed_point64< Q >::print() const
Prints the fixed point value.
Prints the fixed point value
function operator= (1/2)
template<uint8_t QR>
fixed_point64& eosio::fixed_point64< Q >::operator=(
const fixed_point32< QR > & r
)
Assignment operator.
Assignment operator. Assign fixed_point32 to fixed_point64
Template parameters:
- qr - Precision of the source
Parameters:
- r - Source
Returns:
fixed_point64& - Reference to this object
function operator= (2/2)
template<uint8_t QR>
fixed_point64& eosio::fixed_point64< Q >::operator=(
const fixed_point64< QR > & r
)
Assignment operator.
Assignment operator. Assign fixed_point64 to fixed_point64
Template parameters:
- qr - Precision of the source
Parameters:
- r - Source
Returns:
fixed_point64& - Reference to this object
function operator+ (1/2)
template<uint8_t QR>
fixed_point64< (Q>QR)?Q:QR > eosio::fixed_point64< Q >::operator+(
const fixed_point64< QR > & r
) const
Addition operator.
Addition operator
Template parameters:
- QR - Precision of the second addend
Parameters:
- r - Second addend
Returns:
- The result of addition
function operator- (1/2)
template<uint8_t QR>
fixed_point64< (Q>QR)?Q:QR > eosio::fixed_point64< Q >::operator-(
const fixed_point64< QR > & r
) const
Subtraction operator.
Subtraction operator
Template parameters:
- QR - Precision of the minuend
Parameters:
- r - Minuend
Returns:
- The result of subtraction
function operator*
template<uint8_t QR>
fixed_point128< Q+QR > eosio::fixed_point64< Q >::operator*(
const fixed_point64< QR > & r
) const
Multiplication operator.
Multiplication operator for fixed_point64. The result goes to fixed_point64. Multiplication operator
Template parameters:
- QR - Precision of the multiplier
Parameters:
- r - Multiplier
Returns:
- The result of multiplication
Multiplication operator for fixed_point64. The result goes to fixed_point128 Number of decimal on result will be sum of number of decimals of lhs and rhs Example:
fixed_point128<33> result = fixed_point64<0>(131313) / fixed_point64<0>(2323)
function operator/
template<uint8_t QR>
fixed_point128< Q+64-QR > eosio::fixed_point64< Q >::operator/(
const fixed_point64< QR > & r
) const
Division operator.
Division of two fixed_point64 result will be stored in fixed_point128. Division operator
Template parameters:
- QR - Precision of the divisor
Parameters:
- r - Divisor
Returns:
- The result of division
Division operator for fixed_point64 Example:
fixed_point128<33> result = fixed_point64<0>(131313) / fixed_point64<0>(2323)
function operator==
template<uint8_t QR>
bool eosio::fixed_point64< Q >::operator==(
const fixed_point64< QR > & r
)
Equality operator.
Equality operator
Template parameters:
- qr - Precision of the source
Parameters:
- r - Source
Returns:
true - if equal
Returns:
false - otherwise
function operator>
template<uint8_t QR>
bool eosio::fixed_point64< Q >::operator>(
const fixed_point64< QR > & r
)
Greater than operator.
Greater than operator
Template parameters:
- qr - Precision of the source
Parameters:
- r - Source
Returns:
true - if equal
Returns:
false - otherwise
function operator<
template<uint8_t QR>
bool eosio::fixed_point64< Q >::operator<(
const fixed_point64< QR > & r
)
Less than operator.
Less than operator
Template parameters:
- qr - Precision of the source
Parameters:
- r - Source
Returns:
true - if equal
Returns:
false - otherwise
function operator+ (2/2)
template<uint8_t QR>
fixed_point64< (Q>QR)?Q:QR > eosio::fixed_point64< Q >::operator+(
const fixed_point64< QR > & rhs
) const
Addition between two fixed_point64 variables and the result goes to fixed_point64.
Addition between two fixed_point64 variables Number of decimal on result will be max of decimals of lhs and rhs
function operator- (2/2)
template<uint8_t QR>
fixed_point64< (Q>QR)?Q:QR > eosio::fixed_point64< Q >::operator-(
const fixed_point64< QR > & rhs
) const
Subtraction between two fixed_point64 variables and the result goes to fixed_point64.
Subtraction between two fixed_point64 variables Number of decimal on result will be max of decimals of lhs and rhs
The documentation for this class was generated from the following file: libraries/eosiolib/fixedpoint.hpp