xo-unit: + separate basis-unit test
This commit is contained in:
parent
376393b292
commit
f535e393e8
6 changed files with 228 additions and 164 deletions
|
|
@ -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_);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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>,
|
||||
|
|
|
|||
|
|
@ -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_)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue