Inspectopedia
 
2024.3

Call math rounding with 'int' argument

Warning
New
Last modified: 03 December 2024

Reports calls to round(), ceil(), floor(), rint() methods for Math and StrictMath with int as the argument.

These methods could be called in case the argument is expected to be long or double, and it may have unexpected results.

The inspection provides a fix that simplify such expressions (except round) to cast to double.

Example:

After the quick-fix is applied:

New in 2023.1