How to handle floating point comparison warnings (DO NOT MERGE)

There are quite a few of these. I've looked at most of them and they are legitimate == 0.0 comparisons when the float was directly set to 0.0. One way to handle them is to turn off -Wno-float-equal. Another is using the mechanism in this pull (or something similar). Looking for comments on what direction to head.
Taking px4devs comments into account. When we know the values and/or the required precision, i.e. 0 or 1, then something like:

if ( x + 0.5f > 1.0f ) {

}

should do the trick.



On Jul 1, 2014, at 12:33 PM, Don Gagne <notifications@github.com> wrote:

> In src/modules/sensors/sensors.cpp:
> 
> > @@ -1315,7 +1317,7 @@ Sensors::adc_poll(struct sensor_combined_s &raw)
> >  					 * a valid voltage from a connected sensor. Also assume a non-
> >  					 * zero offset from the sensor if its connected.
> >  					 */
> > -					if (voltage > 0.4f && _parameters.diff_pres_analog_enabled) {
> The comparison warning is on _parameters.diff_pres_analog_enabled which is essentially a != 0.0 comparison. How do you propose silencing this compiler warning?
> 
> —
> Reply to this email directly or view it on GitHub.
>