-
Notifications
You must be signed in to change notification settings - Fork 2k
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
floats and doubles being used all over the place. #12045
Comments
Interested! I would like to work on this issue. |
Thanks @garrettluu! Looking forward for your PRs. A good approach would be to open a single PR for each module fixed/updated. |
New here, what is considered a module? For example, is the whole drivers folder a module, or is each folder within the drivers folder a module? @aabadie |
Mostly yes. If you open a PR for each driver it will be easier to verify nothing is broken: only one driver to review/test per PR. |
Draft PR created for sx127x drivers, but I'm unsure of how to test or at least compile my changes without a proper board. |
IMO this is more a rant than an issue. I was so free to create a tracking issue: #19614 I would like to close this in favor of that tracking issue. Please reopen, if anyone disagrees. |
Description
Most platforms do not have HW support for single-precisions floating point and none (aside from native) have support for double precision.
grep
ing through the source code I can find instances of float and double. These are a problem because:sx127x
driver is using doubles.From what I can see, most of these usages are unjustified. In particular all uses of double could be replaced by float.
Steps to reproduce the issue
A quick way to get an approximate search is to use these regexes:
They will catch some false positives and probably miss some false negatives.
Actual results
After some manual cleanup, here are the results:
Double trouble
Summary
What now?
The doubles should go away. I believe that's pretty clear.
There is float usage in sensor drivers. This is in my opinion wrong. The driver should have a layer which is responsible for retrieving data from the device. That layer has no business doing floating point computations. In any case the float is not needed even in cases of sensors like the mpu9150 where values can be perfecly expressed and manipulated using integer math exclusively.
The text was updated successfully, but these errors were encountered: