refactor: 💥 magnitudes code cleanup + mag_pi is now mag<pi>
This commit is contained in:
1 parent
4492d42b91
commit
3671f64153
14 files changed
+494
-666
No files matched your search
@@ -42,11 +42,11 @@ using namespace mp_units;
|
||||
using namespace mp_units::angular;
|
||||
using namespace mp_units::angular::unit_symbols;
|
||||
|
||||
inline constexpr struct half_revolution final : named_unit<"hrev", mag_pi * radian> {
|
||||
inline constexpr struct half_revolution final : named_unit<"hrev", mag<pi> * radian> {
|
||||
} half_revolution;
|
||||
inline constexpr auto hrev = half_revolution;
|
||||
|
||||
// constexpr auto revb6 = mag_ratio<1,3> * mag_pi * rad;
|
||||
// constexpr auto revb6 = mag_ratio<1,3> * mag<pi> * rad;
|
||||
|
||||
TEST_CASE("value_cast should not truncate for valid inputs", "[value_cast]")
|
||||
{
|
||||
|
||||
@@ -216,9 +216,9 @@ static_assert(std::is_same_v<decltype(get_base(power_v<mag_2, 5, 8>{})), mag_2_>
|
||||
|
||||
// SECTION("pi to the 1 supplies correct values")
|
||||
// {
|
||||
// check_same_type_and_value(get_value<float>(mag_pi), std::numbers::pi_v<float>);
|
||||
// check_same_type_and_value(get_value<double>(mag_pi), std::numbers::pi_v<double>);
|
||||
// check_same_type_and_value(get_value<long double>(mag_pi), std::numbers::pi_v<long double>);
|
||||
// check_same_type_and_value(get_value<float>(mag<pi>), std::numbers::pi_v<float>);
|
||||
// check_same_type_and_value(get_value<double>(mag<pi>), std::numbers::pi_v<double>);
|
||||
// check_same_type_and_value(get_value<long double>(mag<pi>), std::numbers::pi_v<long double>);
|
||||
// }
|
||||
|
||||
// SECTION("pi to arbitrary power performs computations in most accurate type at compile time")
|
||||
|
||||
@@ -74,7 +74,7 @@ inline constexpr struct degree_Celsius_ final : named_unit<symbol_text{u8"℃",
|
||||
|
||||
inline constexpr struct minute_ final : named_unit<"min", mag<60> * second> {} minute;
|
||||
inline constexpr struct hour_ final : named_unit<"h", mag<60> * minute> {} hour;
|
||||
inline constexpr struct degree_ final : named_unit<symbol_text{u8"°", "deg"}, mag_pi / mag<180> * radian> {} degree;
|
||||
inline constexpr struct degree_ final : named_unit<symbol_text{u8"°", "deg"}, mag<pi> / mag<180> * radian> {} degree;
|
||||
|
||||
inline constexpr struct yard_ final : named_unit<"yd", mag_ratio<9'144, 10'000> * metre> {} yard;
|
||||
inline constexpr struct mile_ final : named_unit<"mi", mag<1760> * yard> {} mile;
|
||||
@@ -140,7 +140,7 @@ static_assert(get_canonical_unit(radian).mag == mag<1>);
|
||||
|
||||
static_assert(is_of_type<degree, degree_>);
|
||||
static_assert(is_of_type<get_canonical_unit(degree).reference_unit, one_>);
|
||||
static_assert(get_canonical_unit(degree).mag == mag_pi / mag<180>);
|
||||
static_assert(get_canonical_unit(degree).mag == mag<pi> / mag<180>);
|
||||
static_assert(convertible(radian, degree));
|
||||
static_assert(radian != degree);
|
||||
|
||||
|
||||
Reference in new issue
Block a user