No rule to check for incorrect cast from one numeric data type to another

SonarQube 6.7.4.

I cannot find any rule which could alert of an incorrect cast from one numeric data type to another. Such a cast (e.g. from float to int, int to short) may cause loss of precision and cause unexpected behavior.

This is also documented in CWE-681.

There are other cast related rules available (e.g. Redundant casts should not be used, Math operands should be cast before assignment), but they do not cover this behavior.

hello @ankurja,

in Java narrowing conversion is well-defined operation https://docs.oracle.com/javase/specs/jls/se8/html/jls-5.html#jls-5.1.8

So I am not sure that the rule would be actually so useful, because the cast is usually done by purpose.

Do you have some real world examples where such a cast lead to a bug?