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

mpl3115.c uses double #1548

Open
NovaNekmit opened this issue Jun 13, 2023 · 0 comments
Open

mpl3115.c uses double #1548

NovaNekmit opened this issue Jun 13, 2023 · 0 comments

Comments

@NovaNekmit
Copy link

I was compiling my code with -Wdouble-promotion and noticed these warnings:

[...]/src/peripherals/mpl3115.c: In function 'MPL3115ReadBarometer':
[...]/src/peripherals/mpl3115.c:266:51: warning: implicit conversion from 'float' to 'double' to match other operand of binary expression [-Wdouble-promotion]
         float decimal = ( ( float )( lsb >> 4 ) ) / 16.0;
                                                   ^
[...]/src/peripherals/mpl3115.c:275:42: warning: implicit conversion from 'float' to 'double' to match other operand of binary expression [-Wdouble-promotion]
         float decimal = ( ( float )lsb ) / 4.0;
                                          ^

Assuming those are not intentional, it should be 16.0f / 4.0f instead.

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

No branches or pull requests

1 participant