To
to q
<mp-units/math.h>
template<
Unit auto To,
auto R,
typename Rep>
[[nodiscard]]
constexpr
quantity<detail::clone_reference_with<To>(R), 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>;
Returns the value res
representable in To
unit that is the closest to q
. If there are two such values, returns the even value (that is, the value res
such that res % 2 == 0
).
To
, rounding to even in halfway cases.
Name | Description |
---|---|
q | Quantity being the base of the operation |
Name | Description |
---|---|
q | A quantity |