round overloads

Synopses

Declared in <mp‐units/math.h>

Computes the nearest quantity with integer representation and unit type To to q

template<
    Unit auto To,
    auto R,
    typename Rep>
[[nodiscard]]
constexpr
quantity<detail::clone_reference_with<To>®, Rep>
round(quantity<R, Rep> const& q) noexcept
requires requires {
    mp_units::floor<To>(q);
    representation_values<Rep>::one();
  } && std::constructible_from<std::int64_t, Rep>;

Computes the nearest quantity point with integer representation and unit type To to qp

template<
    Unit auto To,
    auto R,
    auto PO,
    typename Rep>
[[nodiscard]]
constexpr
QuantityPointOf<quantity_point<R, PO, Rep>::quantity_spec> auto
round(quantity_point<R, PO, Rep> const& qp) noexcept
requires requires {
    mp_units::floor<To>(qp);
    representation_values<Rep>::one();
  } && std::constructible_from<std::int64_t, Rep>;

Return Value

  • Quantity The quantity rounded to the nearest unit To, rounding to even in halfway cases.

  • QuantityPoint The quantity rounded to the nearest unit To, rounding to even in halfway cases.

Template Parameters

Name

Description

q

Quantity being the base of the operation

Parameters

Name

Description

qp

Quantity point being the base of the operation

Created with MrDocs