Universal Numbers Library C++ API
sw::universal -- header-only custom arithmetic types (posit, cfloat, lns, fixpnt, dd/qd, and more)
Loading...
Searching...
No Matches
tracked_bounded.hpp File Reference
#include <universal/utility/directives.hpp>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <limits>
#include <type_traits>
#include <algorithm>

Classes

class  sw::universal::TrackedBounded< T >
 TrackedBounded wraps a scalar type with rigorous interval bounds. More...

Namespaces

namespace  sw
 required std libraries
namespace  sw::universal
namespace  sw::universal::detail

Typedefs

using sw::universal::TrackedBoundedFloat = TrackedBounded<float>
using sw::universal::TrackedBoundedDouble = TrackedBounded<double>

Enumerations

enum class  sw::universal::detail::quotient_position { sw::universal::detail::exact , sw::universal::detail::above , sw::universal::detail::below , sw::universal::detail::unknown }
 Where the true quotient sits relative to the rounded one. More...

Functions

template<typename T>
constexpr bool sw::universal::fma_is_trusted () noexcept
 Is std::fma correctly rounded for T on this build?
template<typename T>
T sw::universal::detail::next_up (T x) noexcept
template<typename T>
T sw::universal::detail::next_down (T x) noexcept
template<typename T>
T sw::universal::detail::two_sum_roundoff (T a, T b, T s) noexcept
 The exact roundoff of a + b, given the rounded sum s (Knuth's TwoSum).
template<typename T>
T sw::universal::detail::add_down (T a, T b) noexcept
 a + b, rounded toward -infinity
template<typename T>
T sw::universal::detail::add_up (T a, T b) noexcept
 a + b, rounded toward +infinity
template<typename T>
T sw::universal::detail::sub_down (T a, T b) noexcept
template<typename T>
T sw::universal::detail::sub_up (T a, T b) noexcept
template<typename T>
bool sw::universal::detail::product_roundoff (T a, T b, T p, T &roundoff) noexcept
 The exact roundoff of a * b is fma(a, b, -p), which holds whenever the product neither overflows nor falls into the subnormal range; below the smallest normal the roundoff itself is no longer representable, so the sign cannot be trusted and the bound is widened unconditionally.
template<typename T>
T sw::universal::detail::mul_down (T a, T b) noexcept
template<typename T>
T sw::universal::detail::mul_up (T a, T b) noexcept
template<typename T>
quotient_position sw::universal::detail::locate_quotient (T a, T b, T q) noexcept
 For a quotient q of a / b, fma(-q, b, a) is the exact residual a - q*b, and the true quotient lies above q exactly when that residual has the same sign as b.
template<typename T>
T sw::universal::detail::div_down (T a, T b) noexcept
template<typename T>
T sw::universal::detail::div_up (T a, T b) noexcept
template<typename T>
T sw::universal::detail::sqrt_down (T x) noexcept
 sqrt(x) is exact when x - r*r is zero; otherwise the true root lies above r when r*r undershoots x.
template<typename T>
T sw::universal::detail::sqrt_up (T x) noexcept
template<typename T>
TrackedBounded< T > sw::universal::make_uncertain (T value, T relative_uncertainty)
 Compute enclosing interval for a value with relative uncertainty.
template<typename T>
TrackedBounded< T > sw::universal::intersect (const TrackedBounded< T > &a, const TrackedBounded< T > &b)
 Compute intersection of two intervals (empty if disjoint).
template<typename T>
TrackedBounded< T > sw::universal::hull (const TrackedBounded< T > &a, const TrackedBounded< T > &b)
 Compute hull (union) of two intervals.