mp_units::truncated¶
Rounding policy with the semantics of static_cast and std::chrono::duration_cast
Synopsis¶
Declared in <mp-units/framework/rounding.h>
inline constexpr truncated_t truncated = truncated{};
Description¶
Rounds towards zero for an integral destination. A floating-point destination gets what its own arithmetic produces, which rounds to nearest. A vector representation converting to an integral type accepts only this policy.
quantity q1 = (1234 * m).in(km, truncated); // 1 km
quantity q2 = (-1234 * m).in(km, truncated); // -1 km
See Also¶
roundedfor rounding to the nearest valuerounded_downfor rounding towards negative infinityrounded_upfor rounding towards positive infinity- Value Conversions for when a policy is needed