<html><head></head><body>I don't think compilers have hard-coded knowledge of fabsf() that would be required to warn here. Compilers can't/don't optimize/analyze floating point as well as integer arithmetic.<br><br>Anyway, signbit () is both faster (just extracts a bit) and safer (handles special values) if you want the sign. If you want to check less than zero, then that's isless() & co. They're not the same thing since negative zero exists.<br><br><div class="gmail_quote">Le 5 juin 2019 14:54:53 GMT+03:00, Steve Lhomme <robux4@ycbcr.xyz> a écrit :<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="k9mail">fabsf( param.val.f_float ) cannot be negative.<br><br>Compilers should warn about this.<hr> src/input/input.c | 2 +-<br> 1 file changed, 1 insertion(+), 1 deletion(-)<br><br>diff --git a/src/input/input.c b/src/input/input.c<br>index a6116ab8e7..97ee9a6bb6 100644<br>--- a/src/input/input.c<br>+++ b/src/input/input.c<br>@@ -1920,7 +1920,7 @@ static bool Control( input_thread_t *p_input,<br>         {<br>             /* Get rate and direction */<br>             float rate = fabsf( param.val.f_float );<br>-            int i_rate_sign = rate < 0 ? -1 : 1;<br>+            int i_rate_sign = param.val.f_float < 0 ? -1 : 1;<br> <br>             /* Check rate bound */<br>             if( rate > INPUT_RATE_MAX )</pre></blockquote></div><br>-- <br>Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.</body></html>