LoRaMac-node icon indicating copy to clipboard operation
LoRaMac-node copied to clipboard

mpl3115.c uses `double`

Open NovaNekmit opened this issue 1 year ago • 0 comments

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.

NovaNekmit avatar Jun 13 '23 14:06 NovaNekmit