Skip to content
Snippets Groups Projects
Commit 2851245e authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Correctly use abs(), fabs() and fabsf() where required. Silences clang warnings.

parent 4ee4b353
Branches
Tags
No related merge requests found
...@@ -793,7 +793,7 @@ int cell_are_neighbours(const struct cell *restrict ci, ...@@ -793,7 +793,7 @@ int cell_are_neighbours(const struct cell *restrict ci,
for (int k = 0; k < 3; k++) { for (int k = 0; k < 3; k++) {
const double center_i = ci->loc[k]; const double center_i = ci->loc[k];
const double center_j = cj->loc[k]; const double center_j = cj->loc[k];
if (fabsf(center_i - center_j) > min_dist) return 0; if (fabs(center_i - center_j) > min_dist) return 0;
} }
return 1; return 1;
...@@ -823,7 +823,7 @@ void cell_check_multipole(struct cell *c, void *data) { ...@@ -823,7 +823,7 @@ void cell_check_multipole(struct cell *c, void *data) {
mb.mass); mb.mass);
for (int k = 0; k < 3; ++k) for (int k = 0; k < 3; ++k)
if (fabsf(ma.CoM[k] - mb.CoM[k]) / fabsf(ma.CoM[k] + mb.CoM[k]) > 1e-5) if (fabs(ma.CoM[k] - mb.CoM[k]) / fabs(ma.CoM[k] + mb.CoM[k]) > 1e-5)
error("Multipole CoM are different (%12.15e vs. %12.15e", ma.CoM[k], error("Multipole CoM are different (%12.15e vs. %12.15e", ma.CoM[k],
mb.CoM[k]); mb.CoM[k]);
......
...@@ -171,7 +171,7 @@ int checkSpacehmax(struct space *s) { ...@@ -171,7 +171,7 @@ int checkSpacehmax(struct space *s) {
} }
/* If within some epsilon we are OK. */ /* If within some epsilon we are OK. */
if (abs(cell_h_max - part_h_max) <= FLT_EPSILON) return 1; if (fabsf(cell_h_max - part_h_max) <= FLT_EPSILON) return 1;
/* There is a problem. Hunt it down. */ /* There is a problem. Hunt it down. */
for (int k = 0; k < s->nr_cells; k++) { for (int k = 0; k < s->nr_cells; k++) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment