[#mp_units-round] = xref:mp_units.adoc[mp_units]::round :relfileprefix: ../ :mrdocs: Computes the nearest quantity with integer representation and unit type `To` to `q` == Synopsis Declared in `<mp‐units/math.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< xref:mp_units/Unit.adoc[Unit] auto To, auto R, typename Rep> [[nodiscard]] constexpr xref:mp_units/quantity-01.adoc[quantity<detail::clone_reference_with<To>(R), Rep>] round(xref:mp_units/quantity-01.adoc[quantity<R, Rep>] const& q) noexcept requires requires { mp_units::floor<To>(q); representation_values<Rep>::one(); } && std::constructible_from<std::int64_t, Rep>; ---- == Description 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`). == Return Value Quantity The quantity rounded to the nearest unit `To`, rounding to even in halfway cases. == Template Parameters [cols=2] |=== | Name | Description | *q* | Quantity being the base of the operation |=== == Parameters [cols=2] |=== | Name | Description | *q* | A quantity |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#