Anytime Instructions

See [Brand2019] and [Brand2020] for details.

Header aarith/float/float_approx_operations.hpp

template<size_t E, size_t M>
auto aarith::anytime_add(const floating_point<E, M> lhs, const floating_point<E, M> rhs, const unsigned int bits = M + 1) -> floating_point<E, M>

Addition of two normfloats using anytime addition: lhs+rhs.

Parameters
  • lhs – The first number that is to be summed up

  • rhs – The second number that is to be summed up

  • bits – The number of most-significant bits that are calculated of the mantissa addition

Template Parameters
  • E – Width of exponent

  • M – Width of mantissa including the leading 1

Returns

The sum

template<size_t E, size_t M>
auto aarith::anytime_sub(const floating_point<E, M> lhs, const floating_point<E, M> rhs, const unsigned int bits = M + 1) -> floating_point<E, M>

Subtraction with floating_points: lhs-rhs.

Parameters
  • lhs – The minuend

  • rhs – The subtrahend

  • bits – The number of most-significant bits that are calculated of the mantissa subtraction

Template Parameters
  • E – Width of exponent

  • M – Width of mantissa including the leading 1

Returns

The difference lhs-rhs

template<size_t E, size_t M>
auto aarith::anytime_mul(const floating_point<E, M> lhs, const floating_point<E, M> rhs, const unsigned int bits = 2 * M) -> floating_point<E, M>

Multiplication with floating_points: lhs*rhs.

Parameters
  • lhs – The multiplicand

  • rhs – The multiplicator

  • bits – The number of most-significant bits that are calculated of the mantissa multiplication

Template Parameters
  • E – Width of exponent

  • M – Width of mantissa including the leading 1

Returns

The product lhs*rhs

template<size_t E, size_t M>
auto aarith::anytime_div(const floating_point<E, M> lhs, const floating_point<E, M> rhs, const unsigned int bits = M + 1) -> floating_point<E, M>

Anytime division with floating_points: lhs/rhs.

Parameters
  • lhs – The dividend

  • rhs – The divisor

  • bits – The number of most-significant bits that are calculated of the mantissa division

Template Parameters
  • E – Width of exponent

  • M – Width of mantissa including the leading 1

Returns

The quotient lhs/rhs