Using (int)(double_expression + 0.5) to round can be inaccurate and slow.
Similar usages have been replaced with lround.
This implements the bugprone-incorrect-roundings clang-tidy check.
-"Casting (double + 0.5) to integer leads to incorrect rounding; consider using lround (#include ) instead"
Using) instead"
(int)(double_expression + 0.5)
to round can be inaccurate and slow. Similar usages have been replaced withlround
. This implements the bugprone-incorrect-roundings clang-tidy check. -"Casting (double + 0.5) to integer leads to incorrect rounding; consider using lround (#include