MTL5 -- Matrix Template Library C++ API
mtl:: -- C++20 header-only linear algebra for mixed-precision algorithm design
Loading...
Searching...
No Matches
mtl::math::error_free_detail Namespace Reference

Functions

template<typename T>
constexpr T pow2 (int e)

Variables

template<typename T>
constexpr int split_shift = (std::numeric_limits<T>::digits + 1) / 2
 Veltkamp's splitting point: s = ceil(digits / 2), factor = 2^s + 1.
template<typename T>
constexpr T split_factor = T((std::uint64_t(1) << split_shift<T>) + 1)
template<typename T>
constexpr T split_limit = pow2<T>(std::numeric_limits<T>::max_exponent - split_shift<T> - 1)
 The end of split's domain, 2^(max_exponent - s - 1): factor * a is at most 2^(max_exponent - 1) + 2^(max_exponent - s - 1), so it cannot overflow.

Function Documentation

◆ pow2()

template<typename T>
T mtl::math::error_free_detail::pow2 ( int e)
constexpr

Variable Documentation

◆ split_factor

template<typename T>
T mtl::math::error_free_detail::split_factor = T((std::uint64_t(1) << split_shift<T>) + 1)
inlineconstexpr

◆ split_limit

template<typename T>
T mtl::math::error_free_detail::split_limit = pow2<T>(std::numeric_limits<T>::max_exponent - split_shift<T> - 1)
inlineconstexpr

The end of split's domain, 2^(max_exponent - s - 1): factor * a is at most 2^(max_exponent - 1) + 2^(max_exponent - s - 1), so it cannot overflow.

(max / factor itself rounds up in double, and factor times it overflows.)

◆ split_shift

template<typename T>
int mtl::math::error_free_detail::split_shift = (std::numeric_limits<T>::digits + 1) / 2
inlineconstexpr

Veltkamp's splitting point: s = ceil(digits / 2), factor = 2^s + 1.