Skip to content

mp_units::rounded

Rounding policy that rounds to the nearest value, and to even in halfway cases

Synopsis

Declared in <mp-units/framework/rounding.h>

inline constexpr rounded_t rounded = rounded{};

Description

It has the semantics of std::chrono::round. A conversion to a floating-point representation type doesn't accept it.

quantity q1 = (1567 * m).in(km, rounded);  // 2 km
quantity q2 = (2500 * m).in(km, rounded);  // 2 km

See Also