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::internal::value< fbits > Class Template Reference

#include <value.hpp>

Public Member Functions

constexpr value ()
constexpr value (bool sign, int scale, const internal::bitblock< fbits > &fraction_without_hidden_bit, bool zero=true, bool inf=false)
constexpr value (const value &initial_value)
constexpr value (signed char initial_value)
constexpr value (short initial_value)
constexpr value (int initial_value)
constexpr value (long initial_value)
constexpr value (long long initial_value)
constexpr value (char initial_value)
constexpr value (unsigned short initial_value)
constexpr value (unsigned int initial_value)
constexpr value (unsigned long initial_value)
constexpr value (unsigned long long initial_value)
 value (float initial_value)
 value (double initial_value)
 value (long double initial_value)
constexpr value & operator= (const value &rhs)
constexpr value< fbits > & operator= (signed char rhs)
constexpr value< fbits > & operator= (short rhs)
constexpr value< fbits > & operator= (int rhs)
constexpr value< fbits > & operator= (long rhs)
constexpr value< fbits > & operator= (long long rhs)
constexpr value< fbits > & operator= (char rhs)
constexpr value< fbits > & operator= (unsigned short rhs)
constexpr value< fbits > & operator= (unsigned int rhs)
constexpr value< fbits > & operator= (unsigned long rhs)
constexpr value< fbits > & operator= (unsigned long long rhs)
value< fbits > & operator= (float rhs)
value< fbits > & operator= (double rhs)
value< fbits > & operator= (long double rhs)
constexpr value< fbits > operator- () const
value< fbits > & operator++ ()
value< fbits > operator++ (int)
constexpr void reset () &
void set (bool sign, int scale, bitblock< fbits > fraction_without_hidden_bit, bool zero=false, bool inf=false, bool nan=false)
void setzero ()
void setinf (bool sign=true)
void setnan ()
void setsign (bool sign=true)
void setscale (int e)
void setfraction (const bitblock< fbits > &fraction_without_hidden_bit)
bool isneg () const
bool ispos () const
constexpr bool iszero () const
constexpr bool isinf () const
constexpr bool isnan () const
bool sign () const
int scale () const
bitblock< fbits > fraction () const
bitblock< fhbits > mantissa () const
int mantissa_exponent () const
template<unsigned Size>
bitblock< Size > nshift (int shift) const
bitblock< fhbits > get_fixed_point () const
template<typename Ty = double>
Ty get_implicit_fraction_value () const
template<typename Ty = double>
Ty sign_value () const
template<typename Ty = double>
Ty scale_value () const
template<typename Ty = double>
Ty fraction_value () const
int to_int () const noexcept
long to_long () const noexcept
long long to_long_long () const noexcept
float to_float () const noexcept
double to_double () const noexcept
long double to_long_double () const noexcept
template<typename Real>
Real to_native () const noexcept
 operator long double () const
 operator double () const
 operator float () const
template<unsigned srcbits, unsigned tgtbits>
void right_extend (const value< srcbits > &src)
template<unsigned tgt_size>
value< tgt_size > round_to () const

Static Public Attributes

static constexpr unsigned fhbits = fbits + 1

Friends

template<unsigned nfbits>
std::ostream & operator<< (std::ostream &ostr, const value< nfbits > &r)
template<unsigned nfbits>
std::istream & operator>> (std::istream &istr, value< nfbits > &r)
template<unsigned nfbits>
bool operator== (const value< nfbits > &lhs, const value< nfbits > &rhs)
template<unsigned nfbits>
bool operator!= (const value< nfbits > &lhs, const value< nfbits > &rhs)
template<unsigned nfbits>
bool operator< (const value< nfbits > &lhs, const value< nfbits > &rhs)
template<unsigned nfbits>
bool operator> (const value< nfbits > &lhs, const value< nfbits > &rhs)
template<unsigned nfbits>
bool operator<= (const value< nfbits > &lhs, const value< nfbits > &rhs)
template<unsigned nfbits>
bool operator>= (const value< nfbits > &lhs, const value< nfbits > &rhs)

Constructor & Destructor Documentation

◆ value() [1/16]

template<unsigned fbits>
sw::universal::internal::value< fbits >::value ( )
inlineconstexpr

◆ value() [2/16]

template<unsigned fbits>
sw::universal::internal::value< fbits >::value ( bool sign,
int scale,
const internal::bitblock< fbits > & fraction_without_hidden_bit,
bool zero = true,
bool inf = false )
inlineconstexpr

◆ value() [3/16]

template<unsigned fbits>
sw::universal::internal::value< fbits >::value ( const value< fbits > & initial_value)
inlineconstexpr

◆ value() [4/16]

template<unsigned fbits>
sw::universal::internal::value< fbits >::value ( signed char initial_value)
inlineconstexpr

◆ value() [5/16]

template<unsigned fbits>
sw::universal::internal::value< fbits >::value ( short initial_value)
inlineconstexpr

◆ value() [6/16]

template<unsigned fbits>
sw::universal::internal::value< fbits >::value ( int initial_value)
inlineconstexpr

◆ value() [7/16]

template<unsigned fbits>
sw::universal::internal::value< fbits >::value ( long initial_value)
inlineconstexpr

◆ value() [8/16]

template<unsigned fbits>
sw::universal::internal::value< fbits >::value ( long long initial_value)
inlineconstexpr

◆ value() [9/16]

template<unsigned fbits>
sw::universal::internal::value< fbits >::value ( char initial_value)
inlineconstexpr

◆ value() [10/16]

template<unsigned fbits>
sw::universal::internal::value< fbits >::value ( unsigned short initial_value)
inlineconstexpr

◆ value() [11/16]

template<unsigned fbits>
sw::universal::internal::value< fbits >::value ( unsigned int initial_value)
inlineconstexpr

◆ value() [12/16]

template<unsigned fbits>
sw::universal::internal::value< fbits >::value ( unsigned long initial_value)
inlineconstexpr

◆ value() [13/16]

template<unsigned fbits>
sw::universal::internal::value< fbits >::value ( unsigned long long initial_value)
inlineconstexpr

◆ value() [14/16]

template<unsigned fbits>
sw::universal::internal::value< fbits >::value ( float initial_value)
inline

◆ value() [15/16]

template<unsigned fbits>
sw::universal::internal::value< fbits >::value ( double initial_value)
inline

◆ value() [16/16]

template<unsigned fbits>
sw::universal::internal::value< fbits >::value ( long double initial_value)
inline

Member Function Documentation

◆ fraction()

template<unsigned fbits>
bitblock< fbits > sw::universal::internal::value< fbits >::fraction ( ) const
inline

◆ fraction_value()

template<unsigned fbits>
template<typename Ty = double>
Ty sw::universal::internal::value< fbits >::fraction_value ( ) const
inline

◆ get_fixed_point()

template<unsigned fbits>
bitblock< fhbits > sw::universal::internal::value< fbits >::get_fixed_point ( ) const
inline

◆ get_implicit_fraction_value()

template<unsigned fbits>
template<typename Ty = double>
Ty sw::universal::internal::value< fbits >::get_implicit_fraction_value ( ) const
inline

◆ isinf()

template<unsigned fbits>
bool sw::universal::internal::value< fbits >::isinf ( ) const
inlineconstexpr

◆ isnan()

template<unsigned fbits>
bool sw::universal::internal::value< fbits >::isnan ( ) const
inlineconstexpr

◆ isneg()

template<unsigned fbits>
bool sw::universal::internal::value< fbits >::isneg ( ) const
inline

◆ ispos()

template<unsigned fbits>
bool sw::universal::internal::value< fbits >::ispos ( ) const
inline

◆ iszero()

template<unsigned fbits>
bool sw::universal::internal::value< fbits >::iszero ( ) const
inlineconstexpr

◆ mantissa()

template<unsigned fbits>
bitblock< fhbits > sw::universal::internal::value< fbits >::mantissa ( ) const
inline

◆ mantissa_exponent()

template<unsigned fbits>
int sw::universal::internal::value< fbits >::mantissa_exponent ( ) const
inline

◆ nshift()

template<unsigned fbits>
template<unsigned Size>
bitblock< Size > sw::universal::internal::value< fbits >::nshift ( int shift) const
inline

◆ operator double()

template<unsigned fbits>
sw::universal::internal::value< fbits >::operator double ( ) const
inlineexplicit

◆ operator float()

template<unsigned fbits>
sw::universal::internal::value< fbits >::operator float ( ) const
inlineexplicit

◆ operator long double()

template<unsigned fbits>
sw::universal::internal::value< fbits >::operator long double ( ) const
inlineexplicit

◆ operator++() [1/2]

template<unsigned fbits>
value< fbits > & sw::universal::internal::value< fbits >::operator++ ( )
inline

◆ operator++() [2/2]

template<unsigned fbits>
value< fbits > sw::universal::internal::value< fbits >::operator++ ( int )
inline

◆ operator-()

template<unsigned fbits>
value< fbits > sw::universal::internal::value< fbits >::operator- ( ) const
inlineconstexpr

◆ operator=() [1/14]

template<unsigned fbits>
value< fbits > & sw::universal::internal::value< fbits >::operator= ( char rhs)
inlineconstexpr

◆ operator=() [2/14]

template<unsigned fbits>
value & sw::universal::internal::value< fbits >::operator= ( const value< fbits > & rhs)
inlineconstexpr

◆ operator=() [3/14]

template<unsigned fbits>
value< fbits > & sw::universal::internal::value< fbits >::operator= ( double rhs)
inline

◆ operator=() [4/14]

template<unsigned fbits>
value< fbits > & sw::universal::internal::value< fbits >::operator= ( float rhs)
inline

◆ operator=() [5/14]

template<unsigned fbits>
value< fbits > & sw::universal::internal::value< fbits >::operator= ( int rhs)
inlineconstexpr

◆ operator=() [6/14]

template<unsigned fbits>
value< fbits > & sw::universal::internal::value< fbits >::operator= ( long double rhs)
inline

◆ operator=() [7/14]

template<unsigned fbits>
value< fbits > & sw::universal::internal::value< fbits >::operator= ( long long rhs)
inlineconstexpr

◆ operator=() [8/14]

template<unsigned fbits>
value< fbits > & sw::universal::internal::value< fbits >::operator= ( long rhs)
inlineconstexpr

◆ operator=() [9/14]

template<unsigned fbits>
value< fbits > & sw::universal::internal::value< fbits >::operator= ( short rhs)
inlineconstexpr

◆ operator=() [10/14]

template<unsigned fbits>
value< fbits > & sw::universal::internal::value< fbits >::operator= ( signed char rhs)
inlineconstexpr

◆ operator=() [11/14]

template<unsigned fbits>
value< fbits > & sw::universal::internal::value< fbits >::operator= ( unsigned int rhs)
inlineconstexpr

◆ operator=() [12/14]

template<unsigned fbits>
value< fbits > & sw::universal::internal::value< fbits >::operator= ( unsigned long long rhs)
inlineconstexpr

◆ operator=() [13/14]

template<unsigned fbits>
value< fbits > & sw::universal::internal::value< fbits >::operator= ( unsigned long rhs)
inlineconstexpr

◆ operator=() [14/14]

template<unsigned fbits>
value< fbits > & sw::universal::internal::value< fbits >::operator= ( unsigned short rhs)
inlineconstexpr

◆ reset()

template<unsigned fbits>
void sw::universal::internal::value< fbits >::reset ( ) &
inlineconstexpr

◆ right_extend()

template<unsigned fbits>
template<unsigned srcbits, unsigned tgtbits>
void sw::universal::internal::value< fbits >::right_extend ( const value< srcbits > & src)
inline

◆ round_to()

template<unsigned fbits>
template<unsigned tgt_size>
value< tgt_size > sw::universal::internal::value< fbits >::round_to ( ) const
inline

◆ scale()

template<unsigned fbits>
int sw::universal::internal::value< fbits >::scale ( ) const
inline

◆ scale_value()

template<unsigned fbits>
template<typename Ty = double>
Ty sw::universal::internal::value< fbits >::scale_value ( ) const
inline

◆ set()

template<unsigned fbits>
void sw::universal::internal::value< fbits >::set ( bool sign,
int scale,
bitblock< fbits > fraction_without_hidden_bit,
bool zero = false,
bool inf = false,
bool nan = false )
inline

◆ setfraction()

template<unsigned fbits>
void sw::universal::internal::value< fbits >::setfraction ( const bitblock< fbits > & fraction_without_hidden_bit)
inline

◆ setinf()

template<unsigned fbits>
void sw::universal::internal::value< fbits >::setinf ( bool sign = true)
inline

◆ setnan()

template<unsigned fbits>
void sw::universal::internal::value< fbits >::setnan ( )
inline

◆ setscale()

template<unsigned fbits>
void sw::universal::internal::value< fbits >::setscale ( int e)
inline

◆ setsign()

template<unsigned fbits>
void sw::universal::internal::value< fbits >::setsign ( bool sign = true)
inline

◆ setzero()

template<unsigned fbits>
void sw::universal::internal::value< fbits >::setzero ( )
inline

◆ sign()

template<unsigned fbits>
bool sw::universal::internal::value< fbits >::sign ( ) const
inline

◆ sign_value()

template<unsigned fbits>
template<typename Ty = double>
Ty sw::universal::internal::value< fbits >::sign_value ( ) const
inline

◆ to_double()

template<unsigned fbits>
double sw::universal::internal::value< fbits >::to_double ( ) const
inlinenoexcept

◆ to_float()

template<unsigned fbits>
float sw::universal::internal::value< fbits >::to_float ( ) const
inlinenoexcept

◆ to_int()

template<unsigned fbits>
int sw::universal::internal::value< fbits >::to_int ( ) const
inlinenoexcept

◆ to_long()

template<unsigned fbits>
long sw::universal::internal::value< fbits >::to_long ( ) const
inlinenoexcept

◆ to_long_double()

template<unsigned fbits>
long double sw::universal::internal::value< fbits >::to_long_double ( ) const
inlinenoexcept

◆ to_long_long()

template<unsigned fbits>
long long sw::universal::internal::value< fbits >::to_long_long ( ) const
inlinenoexcept

◆ to_native()

template<unsigned fbits>
template<typename Real>
Real sw::universal::internal::value< fbits >::to_native ( ) const
inlinenoexcept

◆ operator!=

template<unsigned fbits>
template<unsigned nfbits>
bool operator!= ( const value< nfbits > & lhs,
const value< nfbits > & rhs )
friend

◆ operator<

template<unsigned fbits>
template<unsigned nfbits>
bool operator< ( const value< nfbits > & lhs,
const value< nfbits > & rhs )
friend

◆ operator<<

template<unsigned fbits>
template<unsigned nfbits>
std::ostream & operator<< ( std::ostream & ostr,
const value< nfbits > & r )
friend

◆ operator<=

template<unsigned fbits>
template<unsigned nfbits>
bool operator<= ( const value< nfbits > & lhs,
const value< nfbits > & rhs )
friend

◆ operator==

template<unsigned fbits>
template<unsigned nfbits>
bool operator== ( const value< nfbits > & lhs,
const value< nfbits > & rhs )
friend

◆ operator>

template<unsigned fbits>
template<unsigned nfbits>
bool operator> ( const value< nfbits > & lhs,
const value< nfbits > & rhs )
friend

◆ operator>=

template<unsigned fbits>
template<unsigned nfbits>
bool operator>= ( const value< nfbits > & lhs,
const value< nfbits > & rhs )
friend

◆ operator>>

template<unsigned fbits>
template<unsigned nfbits>
std::istream & operator>> ( std::istream & istr,
value< nfbits > & r )
friend

Member Data Documentation

◆ fhbits

template<unsigned fbits>
unsigned sw::universal::internal::value< fbits >::fhbits = fbits + 1
staticconstexpr

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