|
Universal Numbers Library C++ API
sw::universal -- header-only custom arithmetic types (posit, cfloat, lns, fixpnt, dd/qd, and more)
|
#include <qd_impl.hpp>
Public Member Functions | |
| qd ()=default | |
| trivial constructor | |
| qd (const qd &)=default | |
| qd (qd &&)=default | |
| qd & | operator= (const qd &)=default |
| qd & | operator= (qd &&)=default |
| qd (const std::string &stringRep) | |
| constexpr | qd (const SpecificValue code) noexcept |
| constexpr | qd (double x0) noexcept |
| constexpr | qd (double x0, double x1) noexcept |
| constexpr | qd (double x0, double x1, double x2, double x3) noexcept |
| constexpr | qd (signed char iv) noexcept |
| constexpr | qd (short iv) noexcept |
| constexpr | qd (int iv) noexcept |
| constexpr | qd (long iv) noexcept |
| constexpr | qd (long long iv) noexcept |
| constexpr | qd (char iv) noexcept |
| constexpr | qd (unsigned short iv) noexcept |
| constexpr | qd (unsigned int iv) noexcept |
| constexpr | qd (unsigned long iv) noexcept |
| constexpr | qd (unsigned long long iv) noexcept |
| constexpr | qd (float iv) noexcept |
| constexpr qd & | operator= (signed char rhs) noexcept |
| constexpr qd & | operator= (short rhs) noexcept |
| constexpr qd & | operator= (int rhs) noexcept |
| constexpr qd & | operator= (long rhs) noexcept |
| constexpr qd & | operator= (long long rhs) noexcept |
| constexpr qd & | operator= (unsigned char rhs) noexcept |
| constexpr qd & | operator= (unsigned short rhs) noexcept |
| constexpr qd & | operator= (unsigned int rhs) noexcept |
| constexpr qd & | operator= (unsigned long rhs) noexcept |
| constexpr qd & | operator= (unsigned long long rhs) noexcept |
| constexpr qd & | operator= (float rhs) noexcept |
| constexpr qd & | operator= (double rhs) noexcept |
| constexpr | operator int () const noexcept |
| constexpr | operator long () const noexcept |
| constexpr | operator long long () const noexcept |
| constexpr | operator unsigned int () const noexcept |
| constexpr | operator unsigned long () const noexcept |
| constexpr | operator unsigned long long () const noexcept |
| constexpr | operator float () const noexcept |
| constexpr | operator double () const noexcept |
| constexpr qd | operator- () const noexcept |
| CONSTEXPRESSION qd & | operator+= (const qd &rhs) |
| CONSTEXPRESSION qd & | operator+= (double rhs) |
| CONSTEXPRESSION qd & | operator-= (const qd &rhs) |
| CONSTEXPRESSION qd & | operator-= (double rhs) |
| CONSTEXPRESSION qd & | operator*= (const qd &rhs) |
| CONSTEXPRESSION qd & | operator*= (double rhs) |
| CONSTEXPRESSION qd & | operator/= (const qd &rhs) |
| CONSTEXPRESSION qd & | operator/= (double rhs) |
| qd & | operator++ () |
| overloaded increment operator that find the next valid quad so that x_next - x = ulp(x) A quad-double number is an unevaluated sum of four IEEE double numbers. | |
| qd | operator++ (int) |
| qd & | operator-- () |
| qd | 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 void | setsign (bool sign=true) noexcept |
| constexpr void | setbit (unsigned index, bool b=true) noexcept |
| constexpr void | setbits (uint64_t value) noexcept |
| void | renorm () noexcept |
| void | renorm (double r) noexcept |
| constexpr double | operator[] (int index) const |
| constexpr double & | operator[] (int index) |
| constexpr qd & | maxpos () noexcept |
| constexpr qd & | minpos () noexcept |
| constexpr qd & | zero () noexcept |
| constexpr qd & | minneg () noexcept |
| constexpr qd & | maxneg () noexcept |
| qd & | assign (const std::string &txt) |
| constexpr bool | iszero () const noexcept |
| constexpr bool | isone () const noexcept |
| constexpr bool | ispos () const noexcept |
| constexpr bool | isneg () const noexcept |
| BIT_CAST_CONSTEXPR bool | isnan (int NaNType=NAN_TYPE_EITHER) const noexcept |
| BIT_CAST_CONSTEXPR bool | isinf (int InfType=INF_TYPE_EITHER) const noexcept |
| constexpr bool | sign () const noexcept |
| constexpr int | scale () const noexcept |
| constexpr int | exponent () const noexcept |
| constexpr qd | add_kernel (const qd &a, const qd &b) const |
| arithmetic operator helpers | |
| constexpr qd | accurate_addition (const qd &a, const qd &b) const |
| constexpr qd | approximate_addition (const qd &a, const qd &b) const |
| constexpr qd | approximate_addition_explicit (const qd &a, const qd &b) const |
| constexpr qd | approximate_multiplication (const qd &a, const qd &b) const |
| constexpr qd | accurate_multiplication (const qd &a, const qd &b) const |
| constexpr qd | approximate_division (const qd &a, const qd &b) const |
| constexpr qd | accurate_division (const qd &a, const qd &b) const |
| std::string | to_string (std::streamsize precision=7, std::streamsize width=15, bool fixed=false, bool scientific=true, bool internal=false, bool left=false, bool showpos=false, bool uppercase=false, char fill=' ') const |
| decimal string converter helpers | |
Static Public Attributes | |
| static constexpr unsigned | nbits = 256 |
| static constexpr unsigned | es = 11 |
| static constexpr unsigned | fbits = 212 |
| static constexpr int | EXP_BIAS = ((1 << (es - 1u)) - 1l) |
| static constexpr int | MAX_EXP = (es == 1) ? 1 : ((1 << es) - EXP_BIAS - 1) |
| static constexpr int | MIN_EXP_NORMAL = 1 - EXP_BIAS |
| static constexpr int | MIN_EXP_SUBNORMAL = 1 - EXP_BIAS - int(fbits) |
Protected Member Functions | |
| constexpr qd & | convert_signed (int64_t v) noexcept |
| constexpr qd & | convert_unsigned (uint64_t v) noexcept |
| constexpr qd & | convert_ieee754 (float rhs) noexcept |
| constexpr qd & | convert_ieee754 (double rhs) noexcept |
| void | round_string (std::vector< char > &s, int precision, int *decimalPoint) const |
| functional helpers | |
| void | append_exponent (std::string &str, int e) const |
| void | to_digits (std::vector< char > &s, int &exponent, int precision) const |
| decimal string converter helper | |
Protected Attributes | |
| double | x [4] |
Friends | |
| constexpr bool | operator== (const qd &lhs, const qd &rhs) |
| constexpr bool | operator!= (const qd &lhs, const qd &rhs) |
| constexpr bool | operator<= (const qd &lhs, const qd &rhs) |
| constexpr bool | operator>= (const qd &lhs, const qd &rhs) |
| constexpr bool | operator< (const qd &lhs, const qd &rhs) |
| constexpr bool | operator> (const qd &lhs, const qd &rhs) |
| constexpr bool | operator== (const qd &lhs, const double rhs) |
| constexpr bool | operator== (const double lhs, const qd &rhs) |
|
default |
trivial constructor
|
default |
|
default |
|
inline |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
arithmetic operator helpers
|
inlineprotected |
|
inlineconstexpr |
|
inlineconstexpr |
|
inline |
|
inlineconstexprnoexcept |
|
inlineconstexprprotectednoexcept |
|
inlineconstexprprotectednoexcept |
|
inlineconstexprprotectednoexcept |
|
inlineconstexprprotectednoexcept |
|
inlineconstexprnoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineexplicitconstexprnoexcept |
|
inlineexplicitconstexprnoexcept |
|
inlineexplicitconstexprnoexcept |
|
inlineexplicitconstexprnoexcept |
|
inlineexplicitconstexprnoexcept |
|
inlineexplicitconstexprnoexcept |
|
inlineexplicitconstexprnoexcept |
|
inlineexplicitconstexprnoexcept |
|
inline |
|
inline |
overloaded increment operator that find the next valid quad so that x_next - x = ulp(x) A quad-double number is an unevaluated sum of four IEEE double numbers.
The quad-double (a0 a1 a2 a3) represents the exact sum a = a0 + a1 + a2 + a3. Note that for any given representable number x, there can be many representations as an unevaluated sum of four doubles. Hence we require that the quadruple(a0 a1 a2 a3) to satisfy a_(i+1) leq ulp(a_i) / 2 for i=0, 1, 2, with equality only occuring when a_i = 0, or the last bit of a_i is 0 Note that the first a0 is the double precision approximation of the quad-double number, accurate to almost half an ulp.
|
inline |
|
inline |
|
inlineconstexprnoexcept |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlineprotected |
functional helpers
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineprotected |
decimal string converter helper
to_digits generates the decimal digits representing
| s | |
| exponent | |
| precision |
|
inline |
decimal string converter helpers
|
inlineconstexprnoexcept |
|
friend |
|
friend |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
protected |