Template Function librapid::detail::multiprec::addSmallX2(const T, const T)#

Function Documentation#

template<typename T>
constexpr auto librapid::detail::multiprec::addSmallX2(const T x, const T y) noexcept -> Fmp<T>#

Combines two 1x precision values into a 2x precision result with the requirement of specific exponent relationship.

Requires: exponent(x) + countr_zero(significand(x)) >= exponent(y) or x == 0

The result is exact when:

  1. The requirement above is satisfied

  2. No internal overflow occurs

  3. Either underflow is gradual, or no internal underflow occurs

  4. Intermediate precision is either the same as T, or greater than twice the precision of T

  5. Parameters and local variables do not retain extra intermediate precision

  6. Rounding mode is rounding to nearest

Violation of condition 3 or 5 could lead to relative error on the order of epsilon^2.

Violation of other conditions could lead to worse results

Template Parameters

T – Template type

Parameters
  • x – First value

  • y – Second value

Returns

Sum of x and y