Struct diyfp

Struct Documentation

struct diyfp

Public Functions

inline constexpr diyfp(std::uint64_t f_, int e_) noexcept
inline constexpr diyfp(std::uint64_t f_, int e_) noexcept

Public Members

std::uint64_t f = 0
int e = 0

Public Static Functions

static inline diyfp sub(const diyfp &x, const diyfp &y) noexcept

returns x - y

Pre:

x.e == y.e and x.f >= y.f

static inline diyfp mul(const diyfp &x, const diyfp &y) noexcept

returns x * y

Note

The result is rounded. (Only the upper q bits are returned.)

static inline diyfp normalize(diyfp x) noexcept

normalize x such that the significand is >= 2^(q-1)

Pre:

x.f != 0

static inline diyfp normalize_to(const diyfp &x, const int target_exponent) noexcept

normalize x such that the result has the exponent E

Pre:

e >= x.e and the upper e - x.e bits of x.f must be zero.

static inline diyfp sub(const diyfp &x, const diyfp &y) noexcept

returns x - y

Pre:

x.e == y.e and x.f >= y.f

static inline diyfp mul(const diyfp &x, const diyfp &y) noexcept

returns x * y

Note

The result is rounded. (Only the upper q bits are returned.)

static inline diyfp normalize(diyfp x) noexcept

normalize x such that the significand is >= 2^(q-1)

Pre:

x.f != 0

static inline diyfp normalize_to(const diyfp &x, const int target_exponent) noexcept

normalize x such that the result has the exponent E

Pre:

e >= x.e and the upper e - x.e bits of x.f must be zero.

Public Static Attributes

static constexpr int kPrecision = 64