Eliminate a trailing dot before the SI prefix if there are no decimals.

Fixes #617.
pull/620/head
whitequark 2020-05-21 11:22:09 +00:00
parent 51f62362a1
commit 72d9978cac
1 changed files with 1 additions and 1 deletions

View File

@ -365,7 +365,7 @@ std::string SolveSpaceUI::MmToStringSI(double v, int dim) {
v /= pow(10.0, sdeg * dim); v /= pow(10.0, sdeg * dim);
} }
int pdeg = (int)ceil(log10(fabs(v) + 1e-10)); int pdeg = (int)ceil(log10(fabs(v) + 1e-10));
return ssprintf("%#.*g%s%s%s", pdeg + UnitDigitsAfterDecimal(), v, return ssprintf("%.*g%s%s%s", pdeg + UnitDigitsAfterDecimal(), v,
compact ? "" : " ", unit.c_str(), DimToString(dim)); compact ? "" : " ", unit.c_str(), DimToString(dim));
} }
std::string SolveSpaceUI::DegreeToString(double v) { std::string SolveSpaceUI::DegreeToString(double v) {