|
Universal Numbers Library C++ API
sw::universal -- header-only custom arithmetic types (posit, cfloat, lns, fixpnt, dd/qd, and more)
|
#include <cmath>#include <concepts>#include <cstdint>#include <limits>#include <type_traits>#include <universal/number/quire/quire_fwd.hpp>Namespaces | |
| namespace | sw |
| required std libraries | |
| namespace | sw::universal |
Concepts | |
| concept | sw::universal::quire_accumulable |
Functions | |
| template<typename NumberType, unsigned capacity, typename LimbType> requires quire_accumulable<NumberType, capacity, LimbType> | |
| void | sw::universal::accumulator_clear (quire< NumberType, capacity, LimbType > &q) |
| q = 0 | |
| template<typename NumberType, unsigned capacity, typename LimbType, typename Value> requires quire_accumulable<NumberType, capacity, LimbType> && std::same_as<Value, NumberType> | |
| void | sw::universal::accumulator_assign (quire< NumberType, capacity, LimbType > &q, const Value &v) |
| q = v, exactly: v enters the quire as the unrounded product v * 1 | |
| template<typename NumberType, unsigned capacity, typename LimbType, typename Value> requires quire_accumulable<NumberType, capacity, LimbType> && std::same_as<Value, NumberType> | |
| void | sw::universal::accumulator_add_product (quire< NumberType, capacity, LimbType > &q, const Value &a, const Value &b) |
| q += a * b. | |
| template<typename Real, typename NumberType, unsigned capacity, typename LimbType> requires std::is_floating_point_v<Real> && (std::numeric_limits<Real>::digits <= 64) | |
| Real | sw::universal::quire_round_to (const quire< NumberType, capacity, LimbType > &q) |
| Round a quire to float or double: to nearest, ties to even, once, including gradual underflow. | |
| template<typename NumberType, unsigned capacity, typename LimbType, typename Result> requires quire_accumulable<NumberType, capacity, LimbType> | |
| Result | sw::universal::accumulator_value (const quire< NumberType, capacity, LimbType > &q, std::type_identity< Result >) |
| The round-out. | |
| template<typename NumberType, unsigned capacity, typename LimbType> requires quire_accumulable<NumberType, capacity, LimbType> | |
| void | sw::universal::accumulator_merge (quire< NumberType, capacity, LimbType > &q, const quire< NumberType, capacity, LimbType > &other) |
| q += other, exactly: combines the partial quires of a split reduction | |