forked from mpusz/mp-units
refactor: pi
-based magnitude renamed to mag_pi
This commit is contained in:
@@ -33,7 +33,7 @@
|
||||
namespace units {
|
||||
|
||||
struct radian : named_unit<radian, "rad"> {};
|
||||
struct rotation : named_scaled_unit<rotation, "rot", mag<2>() * pi, radian> {};
|
||||
struct rotation : named_scaled_unit<rotation, "rot", mag<2>() * mag_pi, radian> {};
|
||||
struct degree : named_scaled_unit<degree, basic_symbol_text{"°", "deg"}, mag<ratio{1, 360}>(), rotation> {};
|
||||
|
||||
template<Unit U = radian>
|
||||
|
@@ -53,8 +53,8 @@ using factorizer = wheel_factorizer<4>;
|
||||
* GCC 10) which don't yet permit floating point NTTPs.
|
||||
*/
|
||||
template<typename T>
|
||||
concept BaseRep = std::is_same_v<T, std::intmax_t> || std::is_same_v < std::remove_cvref_t<decltype(T::value)>,
|
||||
long double > ;
|
||||
concept BaseRep =
|
||||
std::is_same_v<T, std::intmax_t> || std::is_same_v<std::remove_cvref_t<decltype(T::value)>, long double>;
|
||||
|
||||
/**
|
||||
* @brief A basis vector in our magnitude representation, raised to some rational power.
|
||||
@@ -404,7 +404,7 @@ struct pi_base {
|
||||
/**
|
||||
* @brief A convenient Magnitude constant for pi, which we can manipulate like a regular number.
|
||||
*/
|
||||
inline constexpr Magnitude auto pi = magnitude<base_power<pi_base>{}>{};
|
||||
inline constexpr Magnitude auto mag_pi = magnitude<base_power<pi_base>{}>{};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Magnitude equality implementation.
|
||||
|
@@ -193,9 +193,9 @@ TEST_CASE("magnitude converts to numerical value")
|
||||
|
||||
SECTION("pi to the 1 supplies correct values")
|
||||
{
|
||||
check_same_type_and_value(get_value<float>(pi), std::numbers::pi_v<float>);
|
||||
check_same_type_and_value(get_value<double>(pi), std::numbers::pi_v<double>);
|
||||
check_same_type_and_value(get_value<long double>(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")
|
||||
|
Reference in New Issue
Block a user