<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/54222>54222</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
missing tautological-compare warning for float == double constant
</td>
</tr>
<tr>
<th>Labels</th>
<td>
good first issue,
c,
c++,
clang:diagnostics
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
zygoloid
</td>
</tr>
</table>
<pre>
Example:
```c++
float f = 0.1;
if (f == 0.1) { ... }
```
This is a tautological comparison: the LHS of the comparison is always a `float` value promoted to `double`, and the RHS of the comparison is a value that cannot result from a `float`-to-`double` promotion.
We should probably also warn on `f != non_float_constant`; such comparisons are not tautological, but are equivalent to `!isnan(f)`. We shouldn't warn if the constant value is exactly representable in type `float`. And don't warn on `<`, `<=`, `>=`, `>`, `<=>`.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx1U8GOmzAQ_Rq4jGIRE5Jw4JDdbNVDT22lHlcGG3DleCg2u5t-fceGbchWlazYM0PevPfGrlFeq6c3cRmMSvJTkp2T7JTss3k1CX8IK2Zbg8JDC0l-hoxtk3zJa0rxY8y_l3gJyeEBGGO0nz-ALmH8_d5rB7QEeDF5NNjpRhho8DKIUTu0xAl8r-DL52-AbTzeivGf5lVcAwAhR4a0w4swk4JhxAt6JcFjqEqcahJJBPgjCCsj2Nf_4i4gvifRjbAWPYzKTYYsINz7hhuPm3WHpbVGy9ZqfyhwPU5GhnotanMl-g7hVYwWqG1AJC-3wUaL9jnCPzdonRc29CHPwU1Nv-JKTEcFgd3awSCxnnysqV-TJi3K-sUI6qCdFTZMjUZFGQZ_qVH24GdG-t2Xuf9iCHmj3kTjifyoBrKEgEkKFSz466DWvjA4kc8SV6CzzCR_XAaxBHR3VvHTP_HHj2OKpbLKZZmXIvXaG1VdtHPadndWbGavVGwfii2OMN_l5cbOY7vpTKfRVL33gwsvgn-i1WnfTzUjKAqMeXnfNjTIn6rxFFLrSTk6FDvOedpXdVEWmWybrDxsy31Zq31x5Pu6lUV-zA-Sp0bUyrgqKeiN8Q5RQqtH5yEiUSoq5ry5O8b3eEsYYTtiKbXoLDqvGxeKxTnVFc84z_KsyLa7YssZz_l-dyglP7RCqvyY7DJ1EdqwoIPh2KVjFSXVU-eoaLTz7lYU5GxnlYp0CZ8c7nGsfl87MlrLNJKuovY_kUJWDA">