Skip to content

mp_units::floor

floor overloads

Synopses

Declared in <mp-units/math.h>

Computes the largest quantity with integer representation and unit type To with its number not greater than q

template<
    Unit auto To,
    auto R,
    typename Rep>
[[nodiscard]] constexpr quantity<detail::clone_reference_with<To>(R), Rep> floor(quantity<R, Rep> const& q) noexcept
requires requires { q.in(To, truncated); } &&
           ((treat_as_floating_point<Rep> && (requires(Rep v) { floor(v); }
#if MP_UNITS_HOSTED
                                              || requires(Rep v) { std::floor(v); }
#endif
                                              )) ||
            (!treat_as_floating_point<Rep> && requires { representation_values<Rep>::one(); }));

» more...

Computes the largest quantity point with integer representation and unit type To with its number not greater than qp

template<
    Unit auto To,
    auto R,
    auto PO,
    typename Rep>
[[nodiscard]] constexpr QuantityPointOf<quantity_point<R, PO, Rep>::quantity_spec> auto floor(quantity_point<R, PO, Rep> const& qp) noexcept
requires requires { qp.in(To, truncated); } &&
           ((treat_as_floating_point<Rep> && (requires(Rep v) { floor(v); }
#if MP_UNITS_HOSTED
                                              || requires(Rep v) { std::floor(v); }
#endif
                                              )) ||
            (!treat_as_floating_point<Rep> && requires { representation_values<Rep>::one(); }));

» more...

Return Value

  • Quantity The rounded quantity with unit type To
  • QuantityPoint The rounded quantity point with unit type To

Note

The return value should not be discarded.

Template Parameters

NameDescription
qQuantity being the base of the operation

Parameters

NameDescription
qpQuantityPoint being the base of the operation