Small refactoring of new ratio (resolves #14)

This commit is contained in:
Mateusz Pusz committed 2019-12-28 18:59:53 +01:00
1 parent 23d44c1b4a
commit 17e6b0d75d
6 files changed
+31 -19

No files matched your search

+8 -6
View File
@@ -31,12 +31,14 @@ constexpr auto ratio_text()
{
if constexpr(Ratio::num != 1 || Ratio::den != 1 || Ratio::exp != 0) {
auto txt = basic_fixed_string("[") + regular<Ratio::num>();
if constexpr(Ratio::den == 1 && Ratio::exp == 0) {
return txt + basic_fixed_string("]");
}
else if constexpr (Ratio::den == 1) {
return txt + basic_fixed_string(" \u00D7 10") + superscript<Ratio::exp>() +
basic_fixed_string("]");
if constexpr(Ratio::den == 1) {
if constexpr(Ratio::exp == 0) {
return txt + basic_fixed_string("]");
}
else {
return txt + basic_fixed_string(" \u00D7 10") + superscript<Ratio::exp>() +
basic_fixed_string("]");
}
}
else {
return txt + basic_fixed_string("/") + regular<Ratio::den>() +