xo-unit: + separate basis-unit test

This commit is contained in:
Roland Conybeare 2024-04-28 14:56:32 -04:00
commit f535e393e8
6 changed files with 228 additions and 164 deletions

View file

@ -227,7 +227,7 @@ namespace xo {
inline constexpr Quantity<Repr, Int>
unit_qty(const scaled_unit<Int> & u) {
return Quantity<Repr, Int>
(u.outer_scale_factor_.template to<double>() * ::sqrt(u.outer_scale_sq_),
(u.outer_scale_factor_.template convert_to<double>() * ::sqrt(u.outer_scale_sq_),
u.natural_unit_);
}

View file

@ -70,6 +70,7 @@ namespace xo {
template <typename Int>
using width2x_t = width2x<Int>::type;
#ifdef NOT_USING
template <typename Int>
constexpr
detail::bpu2_rescale_result<Int>
@ -85,7 +86,9 @@ namespace xo {
rr.outer_scale_exact_,
rr.outer_scale_sq_);
}
#endif
#ifdef NOT_USING
template <typename Int>
constexpr
scaled_unit<Int>
@ -99,6 +102,7 @@ namespace xo {
rr.outer_scale_exact_,
rr.outer_scale_sq_);
};
#endif
template <typename Int,
typename Int2x = width2x<Int>,

View file

@ -10,9 +10,11 @@
namespace xo {
namespace qty {
template <typename Int>
template <typename Int, typename OuterScale>
inline std::ostream &
operator<<(std::ostream & os, const scaled_unit<Int> & x) {
operator<<(std::ostream & os,
const scaled_unit<Int, OuterScale> & x)
{
os << "<scaled-unit"
<< xtag("outer_scale_factor", x.outer_scale_factor_)
<< xtag("outer_scale_sq", x.outer_scale_sq_)