|
Universal Numbers Library C++ API
sw::universal -- header-only custom arithmetic types (posit, cfloat, lns, fixpnt, dd/qd, and more)
|
#include <takum_log_impl.hpp>
Public Types | |
| typedef bt | BlockType |
| using | Codec = takum_codec<_nbits, _rbits> |
| using | BlockBinary = blockbinary<nbits, bt, BinaryNumberType::Unsigned> |
Public Member Functions | |
| constexpr bool | in_double_safe_range () const noexcept |
| constexpr bool | takes_extended_path (const takum_log &rhs) const noexcept |
| takum_log ()=default | |
| takum_log (const takum_log &)=default | |
| takum_log (takum_log &&)=default | |
| takum_log & | operator= (const takum_log &)=default |
| takum_log & | operator= (takum_log &&)=default |
| constexpr | takum_log (const SpecificValue code) noexcept |
| constexpr | takum_log (signed char initial_value) noexcept |
| constexpr | takum_log (short initial_value) noexcept |
| constexpr | takum_log (int initial_value) noexcept |
| constexpr | takum_log (long initial_value) noexcept |
| constexpr | takum_log (long long initial_value) noexcept |
| constexpr | takum_log (unsigned int initial_value) noexcept |
| constexpr | takum_log (unsigned long initial_value) noexcept |
| constexpr | takum_log (unsigned long long initial_value) noexcept |
| constexpr | takum_log (float initial_value) noexcept |
| constexpr | takum_log (double initial_value) noexcept |
| constexpr takum_log & | operator= (signed char rhs) noexcept |
| constexpr takum_log & | operator= (short rhs) noexcept |
| constexpr takum_log & | operator= (int rhs) noexcept |
| constexpr takum_log & | operator= (long rhs) noexcept |
| constexpr takum_log & | operator= (long long rhs) noexcept |
| constexpr takum_log & | operator= (char rhs) noexcept |
| constexpr takum_log & | operator= (unsigned short rhs) noexcept |
| constexpr takum_log & | operator= (unsigned int rhs) noexcept |
| constexpr takum_log & | operator= (unsigned long rhs) noexcept |
| constexpr takum_log & | operator= (unsigned long long rhs) noexcept |
| CONSTEXPRESSION takum_log & | operator= (float rhs) noexcept |
| CONSTEXPRESSION takum_log & | operator= (double rhs) noexcept |
| CONSTEXPRESSION | operator int () const noexcept |
| CONSTEXPRESSION | operator long () const noexcept |
| CONSTEXPRESSION | operator long long () const noexcept |
| CONSTEXPRESSION | operator unsigned int () const noexcept |
| CONSTEXPRESSION | operator unsigned long () const noexcept |
| CONSTEXPRESSION | operator unsigned long long () const noexcept |
| CONSTEXPRESSION | operator float () const noexcept |
| CONSTEXPRESSION | operator double () const noexcept |
| constexpr takum_log | operator- () const noexcept |
| constexpr takum_log | reciprocal () const noexcept |
| CONSTEXPRESSION takum_log & | operator+= (const takum_log &rhs) |
| CONSTEXPRESSION takum_log & | operator+= (double rhs) |
| CONSTEXPRESSION takum_log & | operator-= (const takum_log &rhs) |
| CONSTEXPRESSION takum_log & | operator-= (double rhs) |
| CONSTEXPRESSION takum_log & | operator*= (const takum_log &rhs) |
| CONSTEXPRESSION takum_log & | operator*= (double rhs) |
| CONSTEXPRESSION takum_log & | operator/= (const takum_log &rhs) |
| CONSTEXPRESSION takum_log & | operator/= (double rhs) |
| constexpr takum_log & | operator++ () noexcept |
| constexpr takum_log | operator++ (int) noexcept |
| constexpr takum_log & | operator-- () noexcept |
| constexpr takum_log | operator-- (int) noexcept |
| constexpr void | clear () noexcept |
| constexpr void | setzero () noexcept |
| constexpr void | setnar () noexcept |
| constexpr void | setnan (bool sign=false) noexcept |
| constexpr void | setinf (bool sign) noexcept |
| constexpr void | setsign (bool s=true) noexcept |
| constexpr void | setbit (unsigned i, bool v=true) noexcept |
| constexpr void | setbits (uint64_t value) noexcept |
| constexpr takum_log & | maxpos () noexcept |
| constexpr takum_log & | minpos () noexcept |
| constexpr takum_log & | zero () noexcept |
| constexpr takum_log & | minneg () noexcept |
| constexpr takum_log & | maxneg () noexcept |
| constexpr bool | iszero () const noexcept |
| constexpr bool | isneg () const noexcept |
| constexpr bool | ispos () const noexcept |
| constexpr bool | isinf () const noexcept |
| constexpr bool | isnan () const noexcept |
| constexpr bool | isnar () const noexcept |
| constexpr bool | sign () const noexcept |
| constexpr bool | direct () const noexcept |
| constexpr unsigned | regime () const noexcept |
| constexpr unsigned | dr_field () const noexcept |
| constexpr int64_t | characteristic () const noexcept |
| CONSTEXPRESSION double | logarithmic_value () const noexcept |
| CONSTEXPRESSION int64_t | scale () const noexcept |
| constexpr bool | at (unsigned bitIndex) const noexcept |
| constexpr bt | block (unsigned b) const noexcept |
| constexpr uint8_t | nibble (unsigned n) const noexcept |
| constexpr uint64_t | raw_bits () const noexcept |
| constexpr uint64_t | magnitude_bits () const noexcept |
Static Public Member Functions | |
| static constexpr unsigned | dr_to_r (unsigned dr) noexcept |
| static constexpr int64_t | dr_to_c_bias (unsigned dr) noexcept |
| static constexpr unsigned | find_dr (int64_t c) noexcept |
| static constexpr int64_t | max_characteristic () noexcept |
| static constexpr int64_t | min_characteristic () noexcept |
Static Public Attributes | |
| static constexpr unsigned | nbits = _nbits |
| static constexpr unsigned | rbits = _rbits |
| static constexpr unsigned | overhead = Codec::overhead |
| static constexpr unsigned | dr_bits = Codec::dr_bits |
| static constexpr unsigned | nr_dr_values = Codec::nr_dr_values |
| static constexpr unsigned | max_r = Codec::max_r |
| static constexpr unsigned | r_mask = Codec::r_mask |
| static constexpr unsigned | dr_field_mask = Codec::dr_field_mask |
| static constexpr unsigned | maxCharBits = Codec::maxCharBits |
| static constexpr bool | wide_significand = (maxCharBits + 1u) > 53u |
| static constexpr unsigned | characteristic_bits |
| static constexpr bool | l_exact_in_double = (maxCharBits + characteristic_bits) <= 53u |
| static constexpr int64_t | double_safe_characteristic = 510 |
| static constexpr bool | range_fits_double |
| static constexpr double | value_base = 1.6487212707001281468 |
| static constexpr double | log2_of_base = 0.7213475204444817 |
| static constexpr unsigned | bitsInByte = 8ull |
| static constexpr unsigned | bitsInBlock = sizeof(bt) * bitsInByte |
| static constexpr unsigned | nrBlocks = (1 + ((nbits - 1) / bitsInBlock)) |
| static constexpr unsigned | bitsInMSU = (1 + ((nbits - 1) % bitsInBlock)) |
| static constexpr uint64_t | storageMask = (0xFFFFFFFFFFFFFFFFull >> (64 - bitsInBlock)) |
| static constexpr unsigned | MSU = nrBlocks - 1 |
| static constexpr bt | MSU_MASK = bt(bt(~0) >> (nrBlocks * bitsInBlock - nbits)) |
| static constexpr bt | SIGN_BIT_MASK = bt(1ull << ((nbits - 1ull) % bitsInBlock)) |
Protected Member Functions | |
| CONSTEXPRESSION takum_log & | combine_logarithmic (const takum_log &rhs, bool subtract, bool negative) noexcept |
| constexpr takum_log & | flip () noexcept |
| takum_log & | wide_sum (const takum_log &rhs, bool subtract) |
| template<typename SignedInt> | |
| CONSTEXPRESSION takum_log & | convert_signed (SignedInt rhs) noexcept |
| template<typename UnsignedInt> | |
| CONSTEXPRESSION takum_log & | convert_unsigned (UnsignedInt rhs) noexcept |
| constexpr takum_log & | assign_integer_magnitude (uint64_t magnitude, bool negative) noexcept |
| constexpr takum_log & | assign_encoded (const typename Codec::encoded &enc, bool negative) noexcept |
| constexpr takum_log & | assign_logarithm (const takum_log_arith::ddouble &l, bool negative) noexcept |
| constexpr takum_log & | assign_two_log (const takum_log_arith::ddouble &w, bool negative) noexcept |
| constexpr takum_log_arith::ddouble | exact_logarithm () const noexcept |
| template<typename Real> | |
| CONSTEXPRESSION takum_log & | convert_ieee754 (Real rhs) noexcept |
| Convert an IEEE-754 value to the logarithmic takum encoding. | |
| template<typename SignedInt> | |
| CONSTEXPRESSION std::enable_if< std::is_integral< SignedInt >::value &&std::is_signed< SignedInt >::value, SignedInt >::type | to_signed () const noexcept |
| template<typename UnsignedInt> | |
| CONSTEXPRESSION std::enable_if< std::is_integral< UnsignedInt >::value &&std::is_unsigned< UnsignedInt >::value, UnsignedInt >::type | to_unsigned () const noexcept |
| template<typename Integer> | |
| CONSTEXPRESSION Integer | to_integer () const noexcept |
| template<typename TargetFloat> | |
| CONSTEXPRESSION TargetFloat | to_ieee754 () const noexcept |
| Decode to an IEEE-754 value: |x| = sqrt(e)^l = e^(l/2). | |
Static Protected Member Functions | |
| static constexpr uint64_t | nbits_mask () noexcept |
| static constexpr bool | encode_double_l (double l, typename Codec::encoded &out) noexcept |
Friends | |
| template<unsigned nn, unsigned nr, typename nb> | |
| std::ostream & | operator<< (std::ostream &ostr, const takum_log< nn, nr, nb > &r) |
| template<unsigned nn, unsigned nr, typename nb> | |
| std::istream & | operator>> (std::istream &istr, takum_log< nn, nr, nb > &r) |
| template<unsigned nn, unsigned nr, typename nb> | |
| constexpr bool | operator== (const takum_log< nn, nr, nb > &lhs, const takum_log< nn, nr, nb > &rhs) |
| template<unsigned nn, unsigned nr, typename nb> | |
| constexpr bool | operator< (const takum_log< nn, nr, nb > &lhs, const takum_log< nn, nr, nb > &rhs) |
| using sw::universal::takum_log< _nbits, _rbits, bt >::BlockBinary = blockbinary<nbits, bt, BinaryNumberType::Unsigned> |
| typedef bt sw::universal::takum_log< _nbits, _rbits, bt >::BlockType |
| using sw::universal::takum_log< _nbits, _rbits, bt >::Codec = takum_codec<_nbits, _rbits> |
|
default |
|
default |
|
default |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprprotectednoexcept |
|
inlineconstexprprotectednoexcept |
|
inlineconstexprprotectednoexcept |
|
inlineconstexprprotectednoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineprotectednoexcept |
|
inlineprotectednoexcept |
Convert an IEEE-754 value to the logarithmic takum encoding.
|x| = sqrt(e)^l => l = log_sqrt(e)|x| = 2 ln|x|. The pair (c, m) with c = floor(l) and m = l - c is exactly what the shared codec encodes, so everything from here – rounding, carry, saturation – is common with the linear takum.
|
inlineprotectednoexcept |
|
inlineprotectednoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlinestaticconstexprnoexcept |
|
inlinestaticconstexprnoexcept |
|
inlinestaticconstexprprotectednoexcept |
|
inlineconstexprprotectednoexcept |
|
inlinestaticconstexprnoexcept |
|
inlineconstexprprotectednoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlinenoexcept |
|
inlineconstexprnoexcept |
|
inlinestaticconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlinestaticconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlinestaticconstexprprotectednoexcept |
|
inlineconstexprnoexcept |
|
inlineexplicitnoexcept |
|
inlineexplicitnoexcept |
|
inlineexplicitnoexcept |
|
inlineexplicitnoexcept |
|
inlineexplicitnoexcept |
|
inlineexplicitnoexcept |
|
inlineexplicitnoexcept |
|
inlineexplicitnoexcept |
|
inline |
|
inline |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inline |
|
inline |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineconstexprnoexcept |
|
default |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
default |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlinenoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineprotectednoexcept |
Decode to an IEEE-754 value: |x| = sqrt(e)^l = e^(l/2).
|
inlineprotectednoexcept |
|
inlineprotectednoexcept |
|
inlineprotectednoexcept |
|
inlineprotected |
|
inlineconstexprnoexcept |
|
friend |
|
friend |
|
friend |
|
friend |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |