diff --git a/docs/users_guide/framework_basics/faster_than_lightspeed_constants.md b/docs/users_guide/framework_basics/faster_than_lightspeed_constants.md index 08dee875..e8378f27 100644 --- a/docs/users_guide/framework_basics/faster_than_lightspeed_constants.md +++ b/docs/users_guide/framework_basics/faster_than_lightspeed_constants.md @@ -45,7 +45,7 @@ inline constexpr struct speed_of_light_in_vacuum final : } // namespace si2019 inline constexpr struct magnetic_constant final : - named_unit<{u8"ฮผโ‚€", "u_0"}, mag<4> * mag * mag_power<10, -7> * henry / metre> {} magnetic_constant; + named_unit<{u8"ฮผโ‚€", "u_0"}, mag<4> * mag<๐œ‹> * mag_power<10, -7> * henry / metre> {} magnetic_constant; } // namespace mp_units::si ``` diff --git a/docs/users_guide/framework_basics/systems_of_units.md b/docs/users_guide/framework_basics/systems_of_units.md index 18266d4b..c8764306 100644 --- a/docs/users_guide/framework_basics/systems_of_units.md +++ b/docs/users_guide/framework_basics/systems_of_units.md @@ -185,10 +185,11 @@ is defined using a floating-point magnitude having a factor of the number ฯ€ (Pi ```cpp inline constexpr struct pi final : mag_constant> {} pi; +inline constexpr auto ๐œ‹ = pi; ``` ```cpp -inline constexpr struct degree final : named_unit<{u8"ยฐ", "deg"}, mag / mag<180> * si::radian> {} degree; +inline constexpr struct degree final : named_unit<{u8"ยฐ", "deg"}, mag<๐œ‹> / mag<180> * si::radian> {} degree; ``` diff --git a/src/core/include/mp-units/framework/magnitude.h b/src/core/include/mp-units/framework/magnitude.h index fb80a72a..792411bc 100644 --- a/src/core/include/mp-units/framework/magnitude.h +++ b/src/core/include/mp-units/framework/magnitude.h @@ -696,6 +696,7 @@ inline constexpr struct pi final : mag_constant { inline constexpr struct pi final : mag_constant> { #endif } pi; +inline constexpr auto ๐œ‹ = pi; [[deprecated("Use `mag` instead")]] inline constexpr Magnitude auto mag_pi = mag; diff --git a/src/systems/include/mp-units/systems/angular/units.h b/src/systems/include/mp-units/systems/angular/units.h index 9a9a766f..e0de553f 100644 --- a/src/systems/include/mp-units/systems/angular/units.h +++ b/src/systems/include/mp-units/systems/angular/units.h @@ -41,7 +41,7 @@ QUANTITY_SPEC(angle, dim_angle); QUANTITY_SPEC(solid_angle, pow<2>(angle)); inline constexpr struct radian final : named_unit<"rad", kind_of> {} radian; -inline constexpr struct revolution final : named_unit<"rev", mag<2> * mag * radian> {} revolution; +inline constexpr struct revolution final : named_unit<"rev", mag<2> * mag<๐œ‹> * radian> {} revolution; inline constexpr struct degree final : named_unit * revolution> {} degree; inline constexpr struct gradian final : named_unit * revolution> {} gradian; inline constexpr struct steradian final : named_unit<"sr", square(radian)> {} steradian; diff --git a/src/systems/include/mp-units/systems/si/constants.h b/src/systems/include/mp-units/systems/si/constants.h index f032bf74..213bdc7e 100644 --- a/src/systems/include/mp-units/systems/si/constants.h +++ b/src/systems/include/mp-units/systems/si/constants.h @@ -57,7 +57,7 @@ inline constexpr struct luminous_efficacy final : inline constexpr struct standard_gravity final : named_unit * metre / square(second)> {} standard_gravity; inline constexpr struct magnetic_constant final : - named_unit * mag * mag_power<10, -7> * henry / metre> {} magnetic_constant; + named_unit * mag<๐œ‹> * mag_power<10, -7> * henry / metre> {} magnetic_constant; // clang-format on } // namespace mp_units::si diff --git a/src/systems/include/mp-units/systems/si/units.h b/src/systems/include/mp-units/systems/si/units.h index cf6521b7..dc9d7f93 100644 --- a/src/systems/include/mp-units/systems/si/units.h +++ b/src/systems/include/mp-units/systems/si/units.h @@ -100,7 +100,7 @@ inline constexpr struct minute final : named_unit<"min", mag<60> * si::second> { inline constexpr struct hour final : named_unit<"h", mag<60> * minute> {} hour; inline constexpr struct day final : named_unit<"d", mag<24> * hour> {} day; inline constexpr struct astronomical_unit final : named_unit<"au", mag<149'597'870'700> * si::metre> {} astronomical_unit; -inline constexpr struct degree final : named_unit / mag<180> * si::radian> {} degree; +inline constexpr struct degree final : named_unit / mag<180> * si::radian> {} degree; inline constexpr struct arcminute final : named_unit * degree> {} arcminute; inline constexpr struct arcsecond final : named_unit * arcminute> {} arcsecond; inline constexpr struct are final : named_unit<"a", square(si::deca)> {} are; diff --git a/test/runtime/truncation_test.cpp b/test/runtime/truncation_test.cpp index 0944210d..770338da 100644 --- a/test/runtime/truncation_test.cpp +++ b/test/runtime/truncation_test.cpp @@ -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 * radian> { +inline constexpr struct half_revolution final : named_unit<"hrev", mag<๐œ‹> * radian> { } half_revolution; inline constexpr auto hrev = half_revolution; -// constexpr auto revb6 = mag_ratio<1,3> * mag * rad; +// constexpr auto revb6 = mag_ratio<1,3> * mag<๐œ‹> * rad; TEST_CASE("value_cast should not truncate for valid inputs", "[value_cast]") { diff --git a/test/static/magnitude_test.cpp b/test/static/magnitude_test.cpp index 329ac016..bf9aba33 100644 --- a/test/static/magnitude_test.cpp +++ b/test/static/magnitude_test.cpp @@ -216,9 +216,9 @@ static_assert(std::is_same_v{})), mag_2_> // SECTION("pi to the 1 supplies correct values") // { -// check_same_type_and_value(get_value(mag), std::numbers::pi_v); -// check_same_type_and_value(get_value(mag), std::numbers::pi_v); -// check_same_type_and_value(get_value(mag), std::numbers::pi_v); +// check_same_type_and_value(get_value(mag<๐œ‹>), std::numbers::pi_v); +// check_same_type_and_value(get_value(mag<๐œ‹>), std::numbers::pi_v); +// check_same_type_and_value(get_value(mag<๐œ‹>), std::numbers::pi_v); // } // SECTION("pi to arbitrary power performs computations in most accurate type at compile time") diff --git a/test/static/unit_symbol_test.cpp b/test/static/unit_symbol_test.cpp index 1e4b2d60..6160191f 100644 --- a/test/static/unit_symbol_test.cpp +++ b/test/static/unit_symbol_test.cpp @@ -150,58 +150,58 @@ inline constexpr struct e final : mag_constant<"e", std::numbers::e_v * one) == "[๐œ‹]"); -static_assert(unit_symbol(mag * one) == "[pi]"); -static_assert(unit_symbol(mag * metre) == "[๐œ‹ m]"); -static_assert(unit_symbol(mag * metre) == "[pi m]"); -static_assert(unit_symbol(mag<2> * mag * metre) == "[2 ๐œ‹ m]"); -static_assert(unit_symbol(mag<2> * mag * metre) == "[2 pi m]"); -static_assert(unit_symbol(mag<2> * mag * metre) == "[2โ‹…๐œ‹ m]"); +static_assert(unit_symbol(mag<๐œ‹> * one) == "[๐œ‹]"); +static_assert(unit_symbol(mag<๐œ‹> * one) == "[pi]"); +static_assert(unit_symbol(mag<๐œ‹> * metre) == "[๐œ‹ m]"); +static_assert(unit_symbol(mag<๐œ‹> * metre) == "[pi m]"); +static_assert(unit_symbol(mag<2> * mag<๐œ‹> * metre) == "[2 ๐œ‹ m]"); +static_assert(unit_symbol(mag<2> * mag<๐œ‹> * metre) == "[2 pi m]"); +static_assert(unit_symbol(mag<2> * mag<๐œ‹> * metre) == "[2โ‹…๐œ‹ m]"); -static_assert(unit_symbol(mag<1> / mag * one) == "[1/๐œ‹]"); -static_assert(unit_symbol(mag<1> / mag * one) == "[1/pi]"); -static_assert(unit_symbol(mag<1> / mag * one) == "[๐œ‹โปยน]"); -static_assert(unit_symbol(mag<1> / mag * one) == "[pi^-1]"); +static_assert(unit_symbol(mag<1> / mag<๐œ‹> * one) == "[1/๐œ‹]"); +static_assert(unit_symbol(mag<1> / mag<๐œ‹> * one) == "[1/pi]"); +static_assert(unit_symbol(mag<1> / mag<๐œ‹> * one) == "[๐œ‹โปยน]"); +static_assert(unit_symbol(mag<1> / mag<๐œ‹> * one) == "[pi^-1]"); -static_assert(unit_symbol(mag<1> / mag * metre) == "[1/๐œ‹ m]"); -static_assert(unit_symbol(mag<1> / mag * metre) == "[1/pi m]"); -static_assert(unit_symbol(mag<1> / mag * metre) == "[๐œ‹โปยน m]"); -static_assert(unit_symbol(mag<1> / mag * metre) == "[pi^-1 m]"); +static_assert(unit_symbol(mag<1> / mag<๐œ‹> * metre) == "[1/๐œ‹ m]"); +static_assert(unit_symbol(mag<1> / mag<๐œ‹> * metre) == "[1/pi m]"); +static_assert(unit_symbol(mag<1> / mag<๐œ‹> * metre) == "[๐œ‹โปยน m]"); +static_assert(unit_symbol(mag<1> / mag<๐œ‹> * metre) == "[pi^-1 m]"); -static_assert(unit_symbol(mag<2> / mag * metre) == "[2/๐œ‹ m]"); -static_assert(unit_symbol(mag<2> / mag * metre) == "[2/pi m]"); -static_assert(unit_symbol(mag<2> / mag * metre) == "[2 ๐œ‹โปยน m]"); -static_assert(unit_symbol(mag<2> / mag * metre) == "[2 pi^-1 m]"); -static_assert(unit_symbol(mag<2> / mag * metre) == "[2โ‹…๐œ‹โปยน m]"); +static_assert(unit_symbol(mag<2> / mag<๐œ‹> * metre) == "[2/๐œ‹ m]"); +static_assert(unit_symbol(mag<2> / mag<๐œ‹> * metre) == "[2/pi m]"); +static_assert(unit_symbol(mag<2> / mag<๐œ‹> * metre) == "[2 ๐œ‹โปยน m]"); +static_assert(unit_symbol(mag<2> / mag<๐œ‹> * metre) == "[2 pi^-1 m]"); +static_assert(unit_symbol(mag<2> / mag<๐œ‹> * metre) == "[2โ‹…๐œ‹โปยน m]"); -static_assert(unit_symbol(mag<1> / (mag<2> * mag)*metre) == "[2โปยน ๐œ‹โปยน m]"); -static_assert(unit_symbol(mag<1> / (mag<2> * mag)*metre) == "[1/(2 ๐œ‹) m]"); -static_assert(unit_symbol(mag<1> / (mag<2> * mag)*metre) == +static_assert(unit_symbol(mag<1> / (mag<2> * mag<๐œ‹>)*metre) == "[2โปยน ๐œ‹โปยน m]"); +static_assert(unit_symbol(mag<1> / (mag<2> * mag<๐œ‹>)*metre) == "[1/(2 ๐œ‹) m]"); +static_assert(unit_symbol(mag<1> / (mag<2> * mag<๐œ‹>)*metre) == "[1/(2 pi) m]"); -static_assert(unit_symbol(mag_ratio<1, 2> / mag * metre) == "[2โปยน ๐œ‹โปยน m]"); -static_assert(unit_symbol(mag_ratio<1, 2> / mag * metre) == "[1/(2 ๐œ‹) m]"); -static_assert(unit_symbol(mag_ratio<1, 2> / mag * metre) == +static_assert(unit_symbol(mag_ratio<1, 2> / mag<๐œ‹> * metre) == "[2โปยน ๐œ‹โปยน m]"); +static_assert(unit_symbol(mag_ratio<1, 2> / mag<๐œ‹> * metre) == "[1/(2 ๐œ‹) m]"); +static_assert(unit_symbol(mag_ratio<1, 2> / mag<๐œ‹> * metre) == "[1/(2 pi) m]"); -static_assert(unit_symbol(mag_ratio<1, 2> * mag * metre) == "[๐œ‹/2 m]"); +static_assert(unit_symbol(mag_ratio<1, 2> * mag<๐œ‹> * metre) == "[๐œ‹/2 m]"); static_assert(unit_symbol(mag_power * one) == "[๐œ‹ยฒ]"); static_assert(unit_symbol(mag_power * one) == "[pi^2]"); static_assert(unit_symbol(mag_power * metre) == "[๐œ‹^(1/2) m]"); static_assert(unit_symbol(mag_power * metre) == "[pi^(1/2) m]"); -static_assert(unit_symbol(mag * mag * one) == "[e ๐œ‹]"); -static_assert(unit_symbol(mag * mag * one) == "[e ๐œ‹]"); -static_assert(unit_symbol(mag * mag * one) == "[e pi]"); -static_assert(unit_symbol(mag / mag * one) == "[๐œ‹/e]"); -static_assert(unit_symbol(mag<1> / mag * mag * one) == "[๐œ‹/e]"); -static_assert(unit_symbol(mag / mag * one) == "[๐œ‹ eโปยน]"); -static_assert(unit_symbol(mag / mag * one) == "[e/๐œ‹]"); -static_assert(unit_symbol(mag<1> / mag * mag * one) == "[e/๐œ‹]"); -static_assert(unit_symbol(mag / mag * one) == "[e ๐œ‹โปยน]"); -static_assert(unit_symbol(mag<1> / (mag * mag)*one) == "[eโปยน ๐œ‹โปยน]"); -static_assert(unit_symbol(mag<1> / (mag * mag)*one) == "[1/(e ๐œ‹)]"); -static_assert(unit_symbol(mag<2> / (mag * mag)*one) == "[2 eโปยน ๐œ‹โปยน]"); -static_assert(unit_symbol(mag<2> / (mag * mag)*one) == "[2/(e ๐œ‹)]"); +static_assert(unit_symbol(mag<๐œ‹> * mag * one) == "[e ๐œ‹]"); +static_assert(unit_symbol(mag * mag<๐œ‹> * one) == "[e ๐œ‹]"); +static_assert(unit_symbol(mag<๐œ‹> * mag * one) == "[e pi]"); +static_assert(unit_symbol(mag<๐œ‹> / mag * one) == "[๐œ‹/e]"); +static_assert(unit_symbol(mag<1> / mag * mag<๐œ‹> * one) == "[๐œ‹/e]"); +static_assert(unit_symbol(mag<๐œ‹> / mag * one) == "[๐œ‹ eโปยน]"); +static_assert(unit_symbol(mag / mag<๐œ‹> * one) == "[e/๐œ‹]"); +static_assert(unit_symbol(mag<1> / mag<๐œ‹> * mag * one) == "[e/๐œ‹]"); +static_assert(unit_symbol(mag / mag<๐œ‹> * one) == "[e ๐œ‹โปยน]"); +static_assert(unit_symbol(mag<1> / (mag<๐œ‹> * mag)*one) == "[eโปยน ๐œ‹โปยน]"); +static_assert(unit_symbol(mag<1> / (mag<๐œ‹> * mag)*one) == "[1/(e ๐œ‹)]"); +static_assert(unit_symbol(mag<2> / (mag<๐œ‹> * mag)*one) == "[2 eโปยน ๐œ‹โปยน]"); +static_assert(unit_symbol(mag<2> / (mag<๐œ‹> * mag)*one) == "[2/(e ๐œ‹)]"); // common units static_assert(unit_symbol(get_common_unit(kilo, mile)) == "EQUIV{[1/25146 mi], [1/15625 km]}"); diff --git a/test/static/unit_test.cpp b/test/static/unit_test.cpp index 1f9782aa..468c5f2c 100644 --- a/test/static/unit_test.cpp +++ b/test/static/unit_test.cpp @@ -58,7 +58,7 @@ inline constexpr struct nu_second_ final : named_unit<"s"> {} nu_second; // derived named units inline constexpr struct radian_ final : named_unit<"rad", metre / metre, kind_of> {} radian; -inline constexpr struct revolution_ final : named_unit<"rev", mag<2> * mag * radian> {} revolution; +inline constexpr struct revolution_ final : named_unit<"rev", mag<2> * mag<๐œ‹> * radian> {} revolution; inline constexpr struct steradian_ final : named_unit<"sr", square(metre) / square(metre), kind_of> {} steradian; inline constexpr struct hertz_ final : named_unit<"Hz", inverse(second), kind_of> {} hertz; inline constexpr struct becquerel_ final : named_unit<"Bq", inverse(second), kind_of> {} becquerel; @@ -70,7 +70,7 @@ inline constexpr struct degree_Celsius_ final : named_unit * second> {} minute; inline constexpr struct hour_ final : named_unit<"h", mag<60> * minute> {} hour; -inline constexpr struct degree_ final : named_unit / mag<180> * radian> {} degree; +inline constexpr struct degree_ final : named_unit / 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; @@ -138,7 +138,7 @@ static_assert(get_canonical_unit(radian).mag == mag<1>); static_assert(is_of_type); static_assert(is_of_type); -static_assert(get_canonical_unit(degree).mag == mag / mag<180>); +static_assert(get_canonical_unit(degree).mag == mag<๐œ‹> / mag<180>); static_assert(convertible(radian, degree)); static_assert(radian != degree);