MCPcopy Create free account
hub / github.com/comaps/comaps / WithPrecision

Function WithPrecision

libs/platform/distance.cpp:57–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55}
56
57double WithPrecision(double value, uint8_t precision)
58{
59 if (precision == 0)
60 return std::round(value);
61
62 double const factor = math::PowUint(10.0, precision);
63 return std::round(value * factor) / factor;
64}
65} // namespace
66
67Distance::Distance() : Distance(-1.0) {}

Callers 2

FormatAltitudeMethod · 0.85
GetFormattedDistanceMethod · 0.85

Calls 1

PowUintFunction · 0.85

Tested by

no test coverage detected