37 constexpr quad() noexcept = default;
53 template <
typename Scalar,
54 std::enable_if_t<(std::is_integral_v<Scalar> ||
55 std::is_floating_point_v<Scalar>) &&
56 (!std::is_same_v<Scalar,
58 constexpr quad(Scalar value)
noexcept
59 :
high_(
static_cast<double>(value)) {}
66 [[nodiscard]]
auto high() const noexcept ->
double {
return high_; }
73 [[nodiscard]]
auto low() const noexcept ->
double {
return low_; }
114 x_l +=
high_ * right.low_;
115 x_l +=
low_ * right.high_;
127 const double inv_right_h = 1.0 / right.high_;
128 const double rate_right = right.low_ * inv_right_h;
129 const double x_h =
high_ * inv_right_h;
131 double x_l = ((
high_ - r_1) - r_2) * inv_right_h;
132 x_l += x_h * ((
low_ /
high_) - rate_right);
153 return quad(left) += right;
164 return quad(left) -= right;
175 return quad(left) *= right;
186 return quad(left) /= right;
Definition of basic operations in multi-double calculations.
class of quadruple precision floating-point numbers
auto operator-=(const quad &right) noexcept -> quad &
subtract another number
auto operator*=(const quad &right) noexcept -> quad &
multiply with another number
auto operator+=(const quad &right) noexcept -> quad &
add another number
auto low() const noexcept -> double
get lower digits
double high_
higher digits
auto high() const noexcept -> double
get higher digits
auto operator-() const noexcept -> quad
negate this number
auto operator/=(const quad &right) noexcept -> quad &
divide by another number
constexpr quad(Scalar value) noexcept
convert implicitly
constexpr quad() noexcept=default
construct zero
auto two_sum(double a, double b) -> std::tuple< double, double >
calculate sum of a and b, and error of the sum
auto two_prod(double a, double b) -> std::tuple< double, double >
calculate product of a and b, and error of the product
auto quick_two_sum(double a, double b) -> std::tuple< double, double >
calculate sum of a and b, and error of the sum on the condition that absolute value of a is larger th...
Namespace of multiple precision numbers with double numbers.
auto operator/(const quad &left, const quad &right) -> quad
divide a number by a number
auto operator*(const quad &left, const quad &right) -> quad
multiply a number by a number
auto operator+(const quad &left, const quad &right) -> quad
add two number
auto operator-(const quad &left, const quad &right) -> quad
subtract a number from a number