Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix rounding of position values when converting from integer to float in _fixupPosition #585

Merged
merged 1 commit into from
Jun 1, 2024

Conversation

ianmcorvidae
Copy link
Contributor

Fixes #572

Luckily, decimal is standard library, so this is pretty easy to fix.

The issue here is this:

>>> Decimal(1e-7)
Decimal('9.99999999999999954748111825886258685613938723690807819366455078125E-8')
>>> Decimal("1e-7")
Decimal('1E-7')

So some positions were ending up as the wrong value due to the multiplication with not quite an actual power of 10.

Copy link

codecov bot commented Jun 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 61.82%. Comparing base (4d67e7f) to head (e8dfee8).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #585      +/-   ##
==========================================
+ Coverage   61.81%   61.82%   +0.01%     
==========================================
  Files          14       14              
  Lines        2941     2942       +1     
==========================================
+ Hits         1818     1819       +1     
  Misses       1123     1123              
Flag Coverage Δ
unittests 61.82% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ianmcorvidae ianmcorvidae merged commit abe98f5 into meshtastic:master Jun 1, 2024
11 checks passed
@ianmcorvidae ianmcorvidae deleted the position-rounding branch June 6, 2024 05:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: rounding issue in longitude when exporting config
1 participant