xo-unit: fix ratio_floor() + check args to Quantity converter

This commit is contained in:
Roland Conybeare 2024-04-17 20:53:54 -04:00
commit 03717ea7e9
2 changed files with 2 additions and 1 deletions

View file

@ -502,6 +502,7 @@ namespace xo {
* @pre @c Quantity2 must have the same dimension as @c *this.
**/
template <typename Quantity2>
requires quantity_concept<Quantity2> && same_dimension_v<unit_type, typename Quantity2::unit_type>
constexpr operator Quantity2 () const {
/* avoid truncating precision when converting:
* use best available representation

View file

@ -13,7 +13,7 @@ namespace xo {
template <typename Ratio>
struct ratio_floor {
using type = std::ratio<Ratio::num/Ratio::den>;
using type = std::ratio<Ratio::num/Ratio::den, 1>;
};
template <typename Ratio>