Skip to content

Commit aad87d8

Browse files
committed
address bugprone-integer-division issues
1 parent 6e69af6 commit aad87d8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

multi_physics/QED/QED_tests/test_picsar_tables.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ void check_table_1d(
310310
const auto x0 = tab.get_x_coord(0);
311311
const auto x1 = tab.get_x_coord(xsize/2);
312312
const auto x2 = tab.get_x_coord(xsize-1);
313-
const auto x1exp = static_cast<double>(xsize/2)*(xmax - xmin)/(xsize-1) + xmin;
313+
const auto x1exp = (xsize/2.0)*(xmax - xmin)/(xsize-1) + xmin;
314314
BOOST_CHECK_SMALL((x0-xmin)/xmin, tolerance<double>());
315315
BOOST_CHECK_SMALL((x1 - x1exp)/x1exp, tolerance<double>());
316316
BOOST_CHECK_SMALL((x2 - xmax)/xmax, tolerance<double>());
@@ -370,7 +370,7 @@ void check_table_2d(
370370
const auto x0 = tab.get_x_coord(0);
371371
const auto x1 = tab.get_x_coord(xsize/2);
372372
const auto x2 = tab.get_x_coord(xsize-1);
373-
const auto x1exp = static_cast<double>(xsize/2)*(xmax - xmin)/(xsize-1) + xmin;
373+
const auto x1exp = (xsize/2.0)*(xmax - xmin)/(xsize-1) + xmin;
374374
BOOST_CHECK_SMALL((x0-xmin)/xmin, tolerance<double>());
375375
BOOST_CHECK_SMALL((x1 - x1exp)/x1exp, tolerance<double>());
376376
BOOST_CHECK_SMALL((x2 - xmax)/xmax, tolerance<double>());
@@ -382,7 +382,7 @@ void check_table_2d(
382382
const auto y0 = tab.get_y_coord(0);
383383
const auto y1 = tab.get_y_coord(ysize/2);
384384
const auto y2 = tab.get_y_coord(ysize-1);
385-
const auto y1exp = (ysize/2)*(ymax - ymin)/(ysize-1) + ymin;
385+
const auto y1exp = (ysize/2.0)*(ymax - ymin)/(ysize-1) + ymin;
386386
BOOST_CHECK_SMALL((y0-ymin)/ymin, tolerance<double>());
387387
BOOST_CHECK_SMALL((y1 - y1exp)/y1exp, tolerance<double>());
388388
BOOST_CHECK_SMALL((y2 - ymax)/ymax, tolerance<double>());

0 commit comments

Comments
 (0)