forked from mpusz/mp-units
extending the range of operator* for incoherent units with large num/den
this improves the situation for #55 (doesn't solve it outright) motivating examples which now work are: 1q_mi * 1q_mi * 1q_mi 1q_au * 1q_au tests added and docs updated
This commit is contained in:
committed by
Mateusz Pusz
parent
9fdb5822f9
commit
834d1fa09d
+5
-5
@@ -26,7 +26,7 @@
|
||||
|
||||
namespace units::detail {
|
||||
|
||||
template<int Value>
|
||||
template<std::intmax_t Value>
|
||||
requires (0 <= Value) && (Value < 10)
|
||||
inline constexpr basic_fixed_string superscript_number = "";
|
||||
|
||||
@@ -43,7 +43,7 @@ template<> inline constexpr basic_fixed_string superscript_number<9> = "\u2079";
|
||||
|
||||
inline constexpr basic_fixed_string superscript_minus = "\u207b";
|
||||
|
||||
template<int Value>
|
||||
template<std::intmax_t Value>
|
||||
constexpr auto superscript()
|
||||
{
|
||||
if constexpr(Value < 0)
|
||||
@@ -54,12 +54,12 @@ constexpr auto superscript()
|
||||
return superscript<Value / 10>() + superscript<Value % 10>();
|
||||
}
|
||||
|
||||
template<int Value>
|
||||
template<std::intmax_t Value>
|
||||
constexpr auto regular()
|
||||
{
|
||||
if constexpr(Value < 0)
|
||||
if constexpr (Value < 0)
|
||||
return basic_fixed_string("-") + superscript<-Value>();
|
||||
else if constexpr(Value < 10)
|
||||
else if constexpr (Value < 10)
|
||||
return basic_fixed_string(static_cast<char>('0' + Value));
|
||||
else
|
||||
return regular<Value / 10>() + regular<Value % 10>();
|
||||
|
||||
Reference in New Issue
Block a user