Replace rounding using int(x+0.5) with roundToInt
[alexxy/gromacs.git] / src / gromacs / gmxana / gmx_editconf.cpp
index 9d012ec3ee674ce08370d01a7f92f9a651ca0253..5b249260b0a67ad914ebfe312c490852fe54a31f 100644 (file)
@@ -381,9 +381,9 @@ static void visualize_box(FILE *out, int a0, int r0, matrix box, const rvec grid
     a0++;
     r0++;
 
-    nx   = static_cast<int>(gridsize[XX] + 0.5);
-    ny   = static_cast<int>(gridsize[YY] + 0.5);
-    nz   = static_cast<int>(gridsize[ZZ] + 0.5);
+    nx   = gmx::roundToInt(gridsize[XX]);
+    ny   = gmx::roundToInt(gridsize[YY]);
+    nz   = gmx::roundToInt(gridsize[ZZ]);
     nbox = nx * ny * nz;
     if (TRICLINIC(box))
     {