BRAINSia / BRAINSTools

A suite of tools for medical image processing focused on brain analysis
http://brainsia.github.io/BRAINSTools/
Apache License 2.0
113 stars 96 forks source link

ENH: Replaced integer cast rounding methods with built in rounding functions. #516

Closed kian-weimer closed 3 years ago

kian-weimer commented 3 years ago

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"