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 e8378f27..6351b99c 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 b8ac5891..de2b562d 100644 --- a/docs/users_guide/framework_basics/systems_of_units.md +++ b/docs/users_guide/framework_basics/systems_of_units.md @@ -196,12 +196,12 @@ For some units, a magnitude might also be irrational. The best example here is a 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; +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/docs/users_guide/framework_basics/text_output.md b/docs/users_guide/framework_basics/text_output.md index 58ad13a7..acb1331c 100644 --- a/docs/users_guide/framework_basics/text_output.md +++ b/docs/users_guide/framework_basics/text_output.md @@ -314,7 +314,7 @@ prints: 40771 EQUIV{[1/25146 mi], [1/15625 km]} 108167 EQUIV{[1/50292 mi], [1/57875 nmi]} 23 EQUIV{[1/5 km/h], [1/18 m/s]} -183.142 EQUIV{[1/๐œ‹ยฐ], [1/180 rad]} +183.142 EQUIV{[1/ฯ€ยฐ], [1/180 rad]} ``` Thanks to the above, it might be easier for the user to reason about the magnitude of the resulting diff --git a/src/core/include/mp-units/framework/magnitude.h b/src/core/include/mp-units/framework/magnitude.h index 3fae880c..e2dea0ca 100644 --- a/src/core/include/mp-units/framework/magnitude.h +++ b/src/core/include/mp-units/framework/magnitude.h @@ -690,13 +690,13 @@ constexpr Magnitude auto mag_power = _pow(mag); * @brief A convenient Magnitude constant for pi, which we can manipulate like a regular number. */ #if defined MP_UNITS_COMP_CLANG || MP_UNITS_COMP_CLANG < 18 -inline constexpr struct pi final : mag_constant { +inline constexpr struct pi final : mag_constant { static constexpr auto _value_ = std::numbers::pi_v; #else -inline constexpr struct pi final : mag_constant> { +inline constexpr struct pi final : mag_constant> { #endif } pi; -inline constexpr auto ๐œ‹ = 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 e0de553f..f707a3b2 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 87e9c171..0b010c25 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 dc9d7f93..b4828beb 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 770338da..5f42ed57 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 bf9aba33..146e709a 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 6160191f..2f73a533 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) == "[ฯ€ยฒ]"); 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) == "[ฯ€^(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]}"); @@ -210,7 +210,7 @@ static_assert(unit_symbol(get_common_unit(kilo / hour, metre / second) / "EQUIV{[1/5 km/h], [1/18 m/s]}/s"); static_assert(unit_symbol(get_common_unit(kilo / hour, metre / second) * second) == "EQUIV{[1/5 km/h], [1/18 m/s]} s"); -static_assert(unit_symbol(get_common_unit(radian, degree)) == "EQUIV{[1/๐œ‹ยฐ], [1/180 rad]}"); +static_assert(unit_symbol(get_common_unit(radian, degree)) == "EQUIV{[1/ฯ€ยฐ], [1/180 rad]}"); // derived units static_assert(unit_symbol(one) == ""); // NOLINT(readability-container-size-empty) diff --git a/test/static/unit_test.cpp b/test/static/unit_test.cpp index 468c5f2c..2269805e 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);