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

Concepts

concept  feeds
 May a V be fed into an exact_accumulator<T>: every V is exactly a T.

Functions

template<typename T>
void decompose (T v, std::uint64_t &m, int &e)
 |v| = m * 2^e with m odd (or v == 0, m == 0). Exact for every finite T.
void mul128 (std::uint64_t a, std::uint64_t b, std::uint64_t &hi, std::uint64_t &lo)
 64 x 64 -> 128, as (hi, lo).
template<std::size_t L>
void add_shifted (std::array< std::uint64_t, L > &w, std::uint64_t hi, std::uint64_t lo, int off, bool subtract)
 acc += sign * (hi:lo) * 2^off, modulo 2^(64 * limbs).
template<typename R, std::size_t L>
R round_out (const std::array< std::uint64_t, L > &w, int lsb)
 Round the nonnegative integer w times 2^lsb to R, once, to nearest-even.

Function Documentation

◆ add_shifted()

template<std::size_t L>
void mtl::math::exact_detail::add_shifted ( std::array< std::uint64_t, L > & w,
std::uint64_t hi,
std::uint64_t lo,
int off,
bool subtract )

acc += sign * (hi:lo) * 2^off, modulo 2^(64 * limbs).

◆ decompose()

template<typename T>
void mtl::math::exact_detail::decompose ( T v,
std::uint64_t & m,
int & e )

|v| = m * 2^e with m odd (or v == 0, m == 0). Exact for every finite T.

◆ mul128()

void mtl::math::exact_detail::mul128 ( std::uint64_t a,
std::uint64_t b,
std::uint64_t & hi,
std::uint64_t & lo )
inline

64 x 64 -> 128, as (hi, lo).

◆ round_out()

template<typename R, std::size_t L>
R mtl::math::exact_detail::round_out ( const std::array< std::uint64_t, L > & w,
int lsb )

Round the nonnegative integer w times 2^lsb to R, once, to nearest-even.