|
Universal Numbers Library C++ API
sw::universal -- header-only custom arithmetic types (posit, cfloat, lns, fixpnt, dd/qd, and more)
|
bisection<Generator, Refinement, nbits, bt, AuxReal> More...
#include <bisection_impl.hpp>
Public Types | |
| using | BlockType = bt |
| using | aux_real_type = AuxReal |
| using | bits_type |
Public Member Functions | |
| bisection () | |
| bisection (const bisection &)=default | |
| bisection (bisection &&)=default | |
| bisection & | operator= (const bisection &)=default |
| bisection & | operator= (bisection &&)=default |
| bisection (int v) | |
| bisection (unsigned v) | |
| bisection (long long v) | |
| bisection (float v) | |
| bisection (double v) | |
| bisection & | operator= (double rhs) |
| bisection & | operator= (int rhs) |
| bisection & | operator= (unsigned rhs) |
| bisection & | operator= (long long rhs) |
| bisection & | operator= (float rhs) |
| template<typename A = AuxReal, typename = std::enable_if_t<!std::is_same<A, double>::value>> | |
| bisection & | operator= (const AuxReal &rhs) |
| operator double () const | |
| template<typename A = AuxReal, typename = std::enable_if_t<!std::is_same<A, double>::value>> | |
| operator AuxReal () const | |
| operator float () const | |
| operator long long () const | |
| bisection | operator- () const |
| bisection & | operator+= (const bisection &rhs) |
| bisection & | operator-= (const bisection &rhs) |
| bisection & | operator*= (const bisection &rhs) |
| bisection & | operator/= (const bisection &rhs) |
| bisection & | operator++ () |
| bisection & | operator-- () |
| bisection | operator++ (int) |
| bisection | operator-- (int) |
| bool | operator== (const bisection &rhs) const |
| bool | operator!= (const bisection &rhs) const |
| bool | operator< (const bisection &rhs) const |
| bool | operator<= (const bisection &rhs) const |
| bool | operator> (const bisection &rhs) const |
| bool | operator>= (const bisection &rhs) const |
| void | setbits (uint64_t v) |
| uint64_t | getbits () const |
| Return the low 64 bits of the encoding. | |
| void | setbit (unsigned index, bool v=true) |
| bool | at (unsigned index) const |
| void | setzero () |
| void | maxpos () |
| void | minpos () |
| void | maxneg () |
| void | minneg () |
| void | setnan () |
| void | setinf (bool negative=false) |
| bool | iszero () const |
| bool | sign () const |
| bool | isnan () const |
| bool | isinf () const |
Static Public Attributes | |
| static constexpr unsigned | nbits = _nbits |
Friends | |
| template<typename G, typename R, unsigned n, typename b, typename A> | |
| std::string | to_binary (const bisection< G, R, n, b, A > &, bool) |
bisection<Generator, Refinement, nbits, bt, AuxReal>
A number system defined by a generator (bracketing sequence) and a refinement (interval bisection) function. The encoding stores nbits of precision in a two's complement integer.
AuxReal is the auxiliary real type used for the interval bisection arithmetic. The default (double) is correct for nbits up to ~50. For wider encodings (or whenever you need higher round-trip ULP accuracy) instantiate with sw::universal::dd (~31 digits) or sw::universal::qd (~63 digits).
| using sw::universal::bisection< Generator, Refinement, _nbits, bt, AuxReal >::aux_real_type = AuxReal |
| using sw::universal::bisection< Generator, Refinement, _nbits, bt, AuxReal >::bits_type |
| using sw::universal::bisection< Generator, Refinement, _nbits, bt, AuxReal >::BlockType = bt |
|
inline |
|
default |
|
default |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Return the low 64 bits of the encoding.
For nbits <= 64 this is the complete encoding (masked to nbits). For nbits > 64 this is LOSSY – use at(index) to read individual bits for the full encoding. The setbits()/getbits() pair does NOT round-trip for wide types; it is provided as a convenience for initialization from small constants.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineexplicit |
|
inlineexplicit |
|
inlineexplicit |
|
inlineexplicit |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
default |
|
inline |
|
default |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
friend |
|
staticconstexpr |