Arduino comparing float with integer and with other floats

I have to do a bit more fine grain than unsigned int comparison.
What is the correct way with the current Arduino IDE 1.8.12 to do the comparison:

Variable power is float.


if ( power < float(17.10) && power >= float(16.25) )
if ( power < 13) )


if ( power < 17.10 && power >= 16.25 )
if ( power < 13) )

A and B should both work but I prefer B.



is redundant. "17.10" cannot be anything BUT a float.

Ray L.

Well, I suppose it could be a double. That matters in some situations but probably not with an Arduino.

Does the compiler "know" that the literal 17.10 can sort-of fit into a float and is not appreciably helped by using a double? I think that the .1 part might be an issue.

Floating point literals without a suffix are of type "double", regardless of their value.