Universal Numbers Library C++ API
sw::universal -- header-only custom arithmetic types (posit, cfloat, lns, fixpnt, dd/qd, and more)
Loading...
Searching...
No Matches
sw::universal::edecimal Class Reference

Adaptive precision decimal integer number type. More...

#include <edecimal_impl.hpp>

Inheritance diagram for sw::universal::edecimal:

Public Member Functions

constexpr edecimal () noexcept
constexpr edecimal (const edecimal &)=default
constexpr edecimal (edecimal &&)=default
constexpr edecimal & operator= (const edecimal &)=default
constexpr edecimal & operator= (edecimal &&)=default
 edecimal (char initial_value)
 edecimal (short initial_value)
 edecimal (int initial_value)
 edecimal (long initial_value)
 edecimal (long long initial_value)
 edecimal (unsigned char initial_value)
 edecimal (unsigned short initial_value)
 edecimal (unsigned int initial_value)
 edecimal (unsigned long initial_value)
 edecimal (unsigned long long initial_value)
 edecimal (float initial_value)
 edecimal (double initial_value)
edecimal & operator= (const std::string &digits)
edecimal & operator= (char rhs)
edecimal & operator= (short rhs)
edecimal & operator= (int rhs)
edecimal & operator= (long rhs)
edecimal & operator= (long long rhs)
edecimal & operator= (unsigned char rhs)
edecimal & operator= (unsigned short rhs)
edecimal & operator= (unsigned int rhs)
edecimal & operator= (unsigned long rhs)
edecimal & operator= (unsigned long long rhs)
edecimal & operator= (float rhs)
edecimal & operator= (double rhs)
edecimal & operator+= (const edecimal &rhs)
edecimal & operator-= (const edecimal &rhs)
edecimal & operator*= (const edecimal &rhs)
edecimal & operator/= (const edecimal &rhs)
edecimal & operator%= (const edecimal &rhs)
edecimal & operator<<= (int shift)
edecimal & operator>>= (int shift)
edecimal operator- () const
edecimal operator++ (int)
edecimal & operator++ ()
edecimal operator-- (int)
edecimal & operator-- ()
 operator unsigned short () const noexcept
 operator unsigned int () const noexcept
 operator unsigned long () const noexcept
 operator unsigned long long () const noexcept
 operator short () const noexcept
 operator int () const noexcept
 operator long () const noexcept
 operator long long () const noexcept
 operator float () const noexcept
 operator double () const noexcept
 operator long double () const noexcept
constexpr bool iszero () const noexcept
constexpr bool sign () const noexcept
constexpr bool isneg () const noexcept
constexpr bool ispos () const noexcept
void setzero ()
constexpr void setsign (bool sign) noexcept
constexpr void setneg () noexcept
constexpr void setpos () noexcept
void setdigit (uint8_t d, bool sign=false)
void setbits (uint64_t v)
void unpad ()
bool parse (const std::string &_digits)

Protected Member Functions

short to_short () const noexcept
int to_int () const noexcept
long to_long () const noexcept
unsigned long long to_ulong_long () const noexcept
long long to_long_long () const noexcept
unsigned short to_ushort () const noexcept
unsigned int to_uint () const noexcept
unsigned long to_ulong () const noexcept
float to_float () const noexcept
double to_double () const noexcept
long double to_long_double () const noexcept
template<typename Ty>
edecimal & convert_integer (Ty v)
template<typename Ty>
edecimal & convert_ieee754 (Ty rhs)

Friends

std::ostream & operator<< (std::ostream &ostr, const edecimal &d)
std::istream & operator>> (std::istream &istr, edecimal &d)
bool operator== (const edecimal &lhs, const edecimal &rhs)
 logic operators
bool operator!= (const edecimal &lhs, const edecimal &rhs)
bool operator< (const edecimal &lhs, const edecimal &rhs)
bool operator> (const edecimal &lhs, const edecimal &rhs)
bool operator<= (const edecimal &lhs, const edecimal &rhs)
bool operator>= (const edecimal &lhs, const edecimal &rhs)

Detailed Description

Adaptive precision decimal integer number type.

The digits are managed as a vector with the digit for 10^0 stored at index 0, 10^1 stored at index 1, etc.

Constructor & Destructor Documentation

◆ edecimal() [1/15]

sw::universal::edecimal::edecimal ( )
inlineconstexprnoexcept

◆ edecimal() [2/15]

sw::universal::edecimal::edecimal ( const edecimal & )
constexprdefault

◆ edecimal() [3/15]

sw::universal::edecimal::edecimal ( edecimal && )
constexprdefault

◆ edecimal() [4/15]

sw::universal::edecimal::edecimal ( char initial_value)
inline

◆ edecimal() [5/15]

sw::universal::edecimal::edecimal ( short initial_value)
inline

◆ edecimal() [6/15]

sw::universal::edecimal::edecimal ( int initial_value)
inline

◆ edecimal() [7/15]

sw::universal::edecimal::edecimal ( long initial_value)
inline

◆ edecimal() [8/15]

sw::universal::edecimal::edecimal ( long long initial_value)
inline

◆ edecimal() [9/15]

sw::universal::edecimal::edecimal ( unsigned char initial_value)
inline

◆ edecimal() [10/15]

sw::universal::edecimal::edecimal ( unsigned short initial_value)
inline

◆ edecimal() [11/15]

sw::universal::edecimal::edecimal ( unsigned int initial_value)
inline

◆ edecimal() [12/15]

sw::universal::edecimal::edecimal ( unsigned long initial_value)
inline

◆ edecimal() [13/15]

sw::universal::edecimal::edecimal ( unsigned long long initial_value)
inline

◆ edecimal() [14/15]

sw::universal::edecimal::edecimal ( float initial_value)
inline

◆ edecimal() [15/15]

sw::universal::edecimal::edecimal ( double initial_value)
inline

Member Function Documentation

◆ convert_ieee754()

template<typename Ty>
edecimal & sw::universal::edecimal::convert_ieee754 ( Ty rhs)
inlineprotected

◆ convert_integer()

template<typename Ty>
edecimal & sw::universal::edecimal::convert_integer ( Ty v)
inlineprotected

◆ isneg()

bool sw::universal::edecimal::isneg ( ) const
inlineconstexprnoexcept

◆ ispos()

bool sw::universal::edecimal::ispos ( ) const
inlineconstexprnoexcept

◆ iszero()

bool sw::universal::edecimal::iszero ( ) const
inlineconstexprnoexcept

◆ operator double()

sw::universal::edecimal::operator double ( ) const
inlineexplicitnoexcept

◆ operator float()

sw::universal::edecimal::operator float ( ) const
inlineexplicitnoexcept

◆ operator int()

sw::universal::edecimal::operator int ( ) const
inlineexplicitnoexcept

◆ operator long()

sw::universal::edecimal::operator long ( ) const
inlineexplicitnoexcept

◆ operator long double()

sw::universal::edecimal::operator long double ( ) const
inlineexplicitnoexcept

◆ operator long long()

sw::universal::edecimal::operator long long ( ) const
inlineexplicitnoexcept

◆ operator short()

sw::universal::edecimal::operator short ( ) const
inlineexplicitnoexcept

◆ operator unsigned int()

sw::universal::edecimal::operator unsigned int ( ) const
inlineexplicitnoexcept

◆ operator unsigned long()

sw::universal::edecimal::operator unsigned long ( ) const
inlineexplicitnoexcept

◆ operator unsigned long long()

sw::universal::edecimal::operator unsigned long long ( ) const
inlineexplicitnoexcept

◆ operator unsigned short()

sw::universal::edecimal::operator unsigned short ( ) const
inlineexplicitnoexcept

◆ operator%=()

edecimal & sw::universal::edecimal::operator%= ( const edecimal & rhs)
inline

◆ operator*=()

edecimal & sw::universal::edecimal::operator*= ( const edecimal & rhs)
inline

◆ operator++() [1/2]

edecimal & sw::universal::edecimal::operator++ ( )
inline

◆ operator++() [2/2]

edecimal sw::universal::edecimal::operator++ ( int )
inline

◆ operator+=()

edecimal & sw::universal::edecimal::operator+= ( const edecimal & rhs)
inline

◆ operator-()

edecimal sw::universal::edecimal::operator- ( ) const
inline

◆ operator--() [1/2]

edecimal & sw::universal::edecimal::operator-- ( )
inline

◆ operator--() [2/2]

edecimal sw::universal::edecimal::operator-- ( int )
inline

◆ operator-=()

edecimal & sw::universal::edecimal::operator-= ( const edecimal & rhs)
inline

◆ operator/=()

edecimal & sw::universal::edecimal::operator/= ( const edecimal & rhs)
inline

◆ operator<<=()

edecimal & sw::universal::edecimal::operator<<= ( int shift)
inline

◆ operator=() [1/15]

edecimal & sw::universal::edecimal::operator= ( char rhs)
inline

◆ operator=() [2/15]

edecimal & sw::universal::edecimal::operator= ( const edecimal & )
constexprdefault

◆ operator=() [3/15]

edecimal & sw::universal::edecimal::operator= ( const std::string & digits)
inline

◆ operator=() [4/15]

edecimal & sw::universal::edecimal::operator= ( double rhs)
inline

◆ operator=() [5/15]

edecimal & sw::universal::edecimal::operator= ( edecimal && )
constexprdefault

◆ operator=() [6/15]

edecimal & sw::universal::edecimal::operator= ( float rhs)
inline

◆ operator=() [7/15]

edecimal & sw::universal::edecimal::operator= ( int rhs)
inline

◆ operator=() [8/15]

edecimal & sw::universal::edecimal::operator= ( long long rhs)
inline

◆ operator=() [9/15]

edecimal & sw::universal::edecimal::operator= ( long rhs)
inline

◆ operator=() [10/15]

edecimal & sw::universal::edecimal::operator= ( short rhs)
inline

◆ operator=() [11/15]

edecimal & sw::universal::edecimal::operator= ( unsigned char rhs)
inline

◆ operator=() [12/15]

edecimal & sw::universal::edecimal::operator= ( unsigned int rhs)
inline

◆ operator=() [13/15]

edecimal & sw::universal::edecimal::operator= ( unsigned long long rhs)
inline

◆ operator=() [14/15]

edecimal & sw::universal::edecimal::operator= ( unsigned long rhs)
inline

◆ operator=() [15/15]

edecimal & sw::universal::edecimal::operator= ( unsigned short rhs)
inline

◆ operator>>=()

edecimal & sw::universal::edecimal::operator>>= ( int shift)
inline

◆ parse()

bool sw::universal::edecimal::parse ( const std::string & _digits)
inline

◆ setbits()

void sw::universal::edecimal::setbits ( uint64_t v)
inline

◆ setdigit()

void sw::universal::edecimal::setdigit ( uint8_t d,
bool sign = false )
inline

◆ setneg()

void sw::universal::edecimal::setneg ( )
inlineconstexprnoexcept

◆ setpos()

void sw::universal::edecimal::setpos ( )
inlineconstexprnoexcept

◆ setsign()

void sw::universal::edecimal::setsign ( bool sign)
inlineconstexprnoexcept

◆ setzero()

void sw::universal::edecimal::setzero ( )
inline

◆ sign()

bool sw::universal::edecimal::sign ( ) const
inlineconstexprnoexcept

◆ to_double()

double sw::universal::edecimal::to_double ( ) const
inlineprotectednoexcept

◆ to_float()

float sw::universal::edecimal::to_float ( ) const
inlineprotectednoexcept

◆ to_int()

int sw::universal::edecimal::to_int ( ) const
inlineprotectednoexcept

◆ to_long()

long sw::universal::edecimal::to_long ( ) const
inlineprotectednoexcept

◆ to_long_double()

long double sw::universal::edecimal::to_long_double ( ) const
inlineprotectednoexcept

◆ to_long_long()

long long sw::universal::edecimal::to_long_long ( ) const
inlineprotectednoexcept

◆ to_short()

short sw::universal::edecimal::to_short ( ) const
inlineprotectednoexcept

◆ to_uint()

unsigned int sw::universal::edecimal::to_uint ( ) const
inlineprotectednoexcept

◆ to_ulong()

unsigned long sw::universal::edecimal::to_ulong ( ) const
inlineprotectednoexcept

◆ to_ulong_long()

unsigned long long sw::universal::edecimal::to_ulong_long ( ) const
inlineprotectednoexcept

◆ to_ushort()

unsigned short sw::universal::edecimal::to_ushort ( ) const
inlineprotectednoexcept

◆ unpad()

void sw::universal::edecimal::unpad ( )
inline

◆ operator!=

bool operator!= ( const edecimal & lhs,
const edecimal & rhs )
friend

◆ operator<

bool operator< ( const edecimal & lhs,
const edecimal & rhs )
friend

◆ operator<<

std::ostream & operator<< ( std::ostream & ostr,
const edecimal & d )
friend

◆ operator<=

bool operator<= ( const edecimal & lhs,
const edecimal & rhs )
friend

◆ operator==

bool operator== ( const edecimal & lhs,
const edecimal & rhs )
friend

logic operators

◆ operator>

bool operator> ( const edecimal & lhs,
const edecimal & rhs )
friend

◆ operator>=

bool operator>= ( const edecimal & lhs,
const edecimal & rhs )
friend

◆ operator>>

std::istream & operator>> ( std::istream & istr,
edecimal & d )
friend

The documentation for this class was generated from the following file:
  • /home/runner/work/universal/universal/include/sw/universal/number/edecimal/edecimal_impl.hpp