An arbitrary, fixed-size floating-point number with configurable gradual under/overflow and saturation/non-saturation arithmetic.
More...
|
| | cfloat ()=default |
| | cfloat (const cfloat &)=default |
| cfloat & | operator= (const cfloat &)=default |
| template<unsigned nnbits, unsigned ees, typename bbt, bool ssub, bool ssup, bool ssat> |
| | cfloat (const cfloat< nnbits, ees, bbt, ssub, ssup, ssat > &rhs) noexcept |
| constexpr | cfloat (const std::string &stringRep) |
| constexpr | cfloat (const SpecificValue code) noexcept |
| constexpr | cfloat (signed char iv) noexcept |
| constexpr | cfloat (short iv) noexcept |
| constexpr | cfloat (int iv) noexcept |
| constexpr | cfloat (long iv) noexcept |
| constexpr | cfloat (long long iv) noexcept |
| constexpr | cfloat (char iv) noexcept |
| constexpr | cfloat (unsigned short iv) noexcept |
| constexpr | cfloat (unsigned int iv) noexcept |
| constexpr | cfloat (unsigned long iv) noexcept |
| constexpr | cfloat (unsigned long long iv) noexcept |
| CONSTEXPRESSION | cfloat (float iv) noexcept |
| CONSTEXPRESSION | cfloat (double iv) noexcept |
| constexpr cfloat & | operator= (signed char rhs) noexcept |
| constexpr cfloat & | operator= (short rhs) noexcept |
| constexpr cfloat & | operator= (int rhs) noexcept |
| constexpr cfloat & | operator= (long rhs) noexcept |
| constexpr cfloat & | operator= (long long rhs) noexcept |
| constexpr cfloat & | operator= (char rhs) noexcept |
| constexpr cfloat & | operator= (unsigned short rhs) noexcept |
| constexpr cfloat & | operator= (unsigned int rhs) noexcept |
| constexpr cfloat & | operator= (unsigned long rhs) noexcept |
| constexpr cfloat & | operator= (unsigned long long rhs) noexcept |
| BIT_CAST_CONSTEXPR cfloat & | operator= (float rhs) noexcept |
| BIT_CAST_CONSTEXPR cfloat & | operator= (double rhs) noexcept |
| constexpr | operator int () const noexcept |
| constexpr | operator long () const noexcept |
| constexpr | operator long long () const noexcept |
| constexpr | operator float () const noexcept |
| constexpr | operator double () const noexcept |
| constexpr cfloat | operator- () const |
| constexpr cfloat & | operator+= (const cfloat &rhs) CFLOAT_EXCEPT |
| constexpr cfloat & | operator+= (double rhs) CFLOAT_EXCEPT |
| constexpr cfloat & | operator-= (const cfloat &rhs) CFLOAT_EXCEPT |
| constexpr cfloat & | operator-= (double rhs) CFLOAT_EXCEPT |
| constexpr cfloat & | operator*= (const cfloat &rhs) CFLOAT_EXCEPT |
| constexpr cfloat & | operator*= (double rhs) CFLOAT_EXCEPT |
| constexpr cfloat & | operator/= (const cfloat &rhs) CFLOAT_EXCEPT |
| constexpr cfloat & | operator/= (double rhs) CFLOAT_EXCEPT |
| constexpr cfloat & | reciprocal () CFLOAT_EXCEPT |
| constexpr cfloat & | operator++ () |
| | move to the next bit encoding modulo 2^nbits
|
| constexpr cfloat | operator++ (int) |
| constexpr cfloat & | operator-- () |
| constexpr cfloat | operator-- (int) |
| constexpr void | clear () noexcept |
| constexpr void | setzero () noexcept |
| constexpr void | setinf (bool sign=true) noexcept |
| constexpr void | setnan (int NaNType=NAN_TYPE_SIGNALLING) noexcept |
| constexpr cfloat | quieted () const noexcept |
| constexpr void | setsign (bool sign=true) |
| constexpr bool | setexponent (int scale) |
| constexpr void | setExponentField (uint64_t ebits) noexcept |
| constexpr void | setfraction (uint64_t raw_bits) |
| constexpr void | setbit (unsigned i, bool v=true) noexcept |
| constexpr cfloat & | setbits (uint64_t raw_bits) noexcept |
| constexpr void | setblock (unsigned b, bt data) noexcept |
| constexpr cfloat & | maxpos () noexcept |
| constexpr cfloat & | minpos () noexcept |
| constexpr cfloat & | zero () noexcept |
| constexpr cfloat & | minneg () noexcept |
| constexpr cfloat & | maxneg () noexcept |
| CONSTEXPRESSION cfloat & | assign (const std::string &str) noexcept |
| | assign an encoding given as a binary string
|
| constexpr bool | sign () const noexcept |
| constexpr int | scale () const noexcept |
| constexpr bool | isneg () const noexcept |
| constexpr bool | ispos () const noexcept |
| constexpr bool | iszero () const noexcept |
| constexpr bool | isone () const noexcept |
| constexpr bool | isinf (int InfType=INF_TYPE_EITHER) const noexcept |
| constexpr bool | isnan (int NaNType=NAN_TYPE_EITHER) const noexcept |
| constexpr bool | iszeroencoding () const noexcept |
| constexpr bool | isminnegencoding () const noexcept |
| constexpr bool | isnanencoding (int NaNType=NAN_TYPE_EITHER) const noexcept |
| constexpr bool | isnormal () const noexcept |
| constexpr bool | isdenormal () const noexcept |
| constexpr bool | ismaxexpvalue () const noexcept |
| constexpr bool | isinteger () const noexcept |
| template<typename NativeReal> |
| constexpr bool | inrange (NativeReal v) const noexcept |
| constexpr bool | test (unsigned bitIndex) const noexcept |
| constexpr bool | at (unsigned bitIndex) const noexcept |
| constexpr uint8_t | nibble (unsigned n) const noexcept |
| constexpr bt | block (unsigned b) const noexcept |
| constexpr void | sign (bool &s) const |
| constexpr uint64_t | exponentField () const noexcept |
| constexpr void | exponent (blockbinary< es, bt > &e) const |
| template<unsigned targetFractionBits> |
| constexpr blockbinary< targetFractionBits, bt > & | fraction (blockbinary< targetFractionBits, bt > &f) const |
| constexpr uint64_t | significand_window (int lo, unsigned n, bool withHidden) const noexcept |
| constexpr bool | fraction_bits_below (int idx) const noexcept |
| constexpr uint64_t | fraction_ull () const |
| constexpr unsigned | significant (blockbinary< fhbits, bt > &s, bool isNormal=true) const |
| template<unsigned targetbits> |
| constexpr void | bits (blockbinary< targetbits, bt > &b) const |
| template<typename Integer> |
| constexpr Integer | to_integer () const noexcept |
| constexpr int | to_int () const noexcept |
| constexpr long | to_long () const noexcept |
| constexpr long long | to_long_long () const noexcept |
| template<typename TargetFloat> |
| constexpr TargetFloat | to_native () const |
| template<typename TargetBlockType = bt> |
| constexpr void | normalize (blocktriple< fbits, BlockTripleOperator::REP, TargetBlockType > &tgt) const |
| constexpr void | normalizeAddition (blocktriple< fbits, BlockTripleOperator::ADD, bt > &tgt) const |
| constexpr void | normalizeMultiplication (blocktriple< fbits, BlockTripleOperator::MUL, bt > &tgt) const |
| constexpr void | normalizeDivision (blocktriple< fbits, BlockTripleOperator::DIV, bt > &tgt) const |
| void | constexprClassParameters () const noexcept |
| void | showLimbs () const |
| template<typename Real> |
| CONSTEXPRESSION bool | convert_ieee754_special (bool s, uint64_t rawExponent, uint64_t rawFraction) noexcept |
| template<typename Real> |
| CONSTEXPRESSION cfloat & | convert_ieee754 (Real rhs) noexcept |
| void constexpr | post_process () noexcept |
|
| constexpr cfloat & | flip () noexcept |
| | 1's complement of the encoding used to set up specific encoding patterns.
|
| void | shiftLeft (unsigned bitsToShift) |
| | shift left is a bit level encoding helper for fast limb-based conversions between different cfloats
|
| template<unsigned sizeInBits> |
| constexpr void | set_integer_fraction (uint64_t raw, int exponent) noexcept |
| template<typename Ty> |
| constexpr cfloat & | convert_unsigned_integer (const Ty &rhs) noexcept |
| template<typename Ty> |
| constexpr cfloat & | convert_signed_integer (const Ty &rhs) noexcept |
| template<unsigned srcbits, typename StorageType> |
| constexpr uint64_t | round (StorageType raw, int &exponent) noexcept |
| | round a set of source bits to the present representation.
|
| template<typename ArgumentBlockType> |
| constexpr void | copyBits (ArgumentBlockType v) |
| void | shiftLeft (int leftShift) |
| void | shiftRight (int rightShift) |
| template<BlockTripleOperator btop, typename TargetBlockType = bt> |
| constexpr void | blockcopy (blocktriple< fbits, btop, TargetBlockType > &tgt) const |
|
| template<unsigned nnbits, unsigned nes, typename nbt, bool nsub, bool nsup, bool nsat> |
| std::ostream & | operator<< (std::ostream &ostr, const cfloat< nnbits, nes, nbt, nsub, nsup, nsat > &r) |
| template<unsigned nnbits, unsigned nes, typename nbt, bool nsub, bool nsup, bool nsat> |
| std::istream & | operator>> (std::istream &istr, cfloat< nnbits, nes, nbt, nsub, nsup, nsat > &r) |
| template<unsigned nnbits, unsigned nes, typename nbt, bool nsub, bool nsup, bool nsat> |
| constexpr bool | operator== (const cfloat< nnbits, nes, nbt, nsub, nsup, nsat > &lhs, const cfloat< nnbits, nes, nbt, nsub, nsup, nsat > &rhs) |
| | cfloat - cfloat binary logic operators
|
| template<unsigned nnbits, unsigned nes, typename nbt, bool nsub, bool nsup, bool nsat> |
| constexpr bool | operator!= (const cfloat< nnbits, nes, nbt, nsub, nsup, nsat > &lhs, const cfloat< nnbits, nes, nbt, nsub, nsup, nsat > &rhs) |
| template<unsigned nnbits, unsigned nes, typename nbt, bool nsub, bool nsup, bool nsat> |
| constexpr bool | operator< (const cfloat< nnbits, nes, nbt, nsub, nsup, nsat > &lhs, const cfloat< nnbits, nes, nbt, nsub, nsup, nsat > &rhs) |
| template<unsigned nnbits, unsigned nes, typename nbt, bool nsub, bool nsup, bool nsat> |
| constexpr bool | operator> (const cfloat< nnbits, nes, nbt, nsub, nsup, nsat > &lhs, const cfloat< nnbits, nes, nbt, nsub, nsup, nsat > &rhs) |
| template<unsigned nnbits, unsigned nes, typename nbt, bool nsub, bool nsup, bool nsat> |
| constexpr bool | operator<= (const cfloat< nnbits, nes, nbt, nsub, nsup, nsat > &lhs, const cfloat< nnbits, nes, nbt, nsub, nsup, nsat > &rhs) |
| template<unsigned nnbits, unsigned nes, typename nbt, bool nsub, bool nsup, bool nsat> |
| constexpr bool | operator>= (const cfloat< nnbits, nes, nbt, nsub, nsup, nsat > &lhs, const cfloat< nnbits, nes, nbt, nsub, nsup, nsat > &rhs) |
template<unsigned _nbits, unsigned _es, typename bt = uint8_t, bool _hasSubnormals = false, bool _hasMaxExpValues = false, bool _isSaturating = false>
class sw::universal::cfloat< _nbits, _es, bt, _hasSubnormals, _hasMaxExpValues, _isSaturating >
An arbitrary, fixed-size floating-point number with configurable gradual under/overflow and saturation/non-saturation arithmetic.
Default configuration offers normal encoding and non-saturating arithmetic. ///
- Template Parameters
-
| nbits | number of bits in the encoding |
| es | number of exponent bits in the encoding |
| bt | the type to use as storage class: one of [uint8_t|uint16_t|uint32_t|uint64_t] |
| hasSubnormals | configure gradual underflow (==subnormals) |
| hasMaxExpValues | reclaim max-exponent encodings as numeric values |
| isSaturating | configure saturation arithmetic |