This commit is contained in:
2026-01-15 19:11:16 +03:00
parent 09cf5f9c19
commit 01d5657b1b
8 changed files with 867 additions and 637 deletions

View File

@@ -244,6 +244,10 @@ static R rad2sxg(double ang, bool hms = false, int prec = 2)
term *= 10.0;
}
// round to given precision of arcseconds/seconds
degs = std::round(degs * 3600.0 * term) / term / 3600.0;
auto d = std::trunc(degs);
auto s = (degs - d) * 60.0;
auto m = std::trunc(s);
@@ -261,7 +265,9 @@ static R rad2sxg(double ang, bool hms = false, int prec = 2)
}
if (ang < 0) {
std::ranges::copy(std::string_view("-"), std::back_inserter(res));
if (!isEqual(d, 0.0) || !isEqual(m, 0.0) || !isEqual(s, 0.0)) {
std::ranges::copy(std::string_view("-"), std::back_inserter(res));
}
}
std::vformat_to(std::back_inserter(res), std::string_view{fmt.begin(), fmt.end()}, std::make_format_args(d, m, s));