Maintain precision of accuracy

This commit is contained in:
Morten Nielsen 2020-07-28 20:44:48 -07:00
parent c9413f2a35
commit 63344030ee

View file

@ -43,7 +43,8 @@ namespace SampleApp.WinDesktop
else if(message is NmeaParser.Messages.Gst gst)
{
Gst = gst;
m_Accuracy = Math.Sqrt(Gst.SigmaLatitudeError * Gst.SigmaLatitudeError + Gst.SigmaLongitudeError * Gst.SigmaLongitudeError);
int significantDigits = (int)Math.Ceiling(-Math.Log(Math.Min(Gst.SigmaLatitudeError%1, Gst.SigmaLongitudeError%1)));
m_Accuracy = Math.Round(Math.Sqrt(Gst.SigmaLatitudeError * Gst.SigmaLatitudeError + Gst.SigmaLongitudeError * Gst.SigmaLongitudeError), significantDigits);
}
else if (message is NmeaParser.Messages.Rmc rmc)
{