diff options
author | Erik Schnetter <schnetter@gmail.com> | 2013-04-02 18:29:33 -0400 |
---|---|---|
committer | Erik Schnetter <schnetter@gmail.com> | 2013-04-02 18:29:33 -0400 |
commit | 671c86c079faa37386f59eb3c814dc837c4df4c5 (patch) | |
tree | 0cf5baa5bb9dc44a05c0b8ea78d867c17d8c1e49 /Carpet/CarpetLib/src/prolongate_3d_cc_enovol_rf2.cc | |
parent | c0c03fece68597fddfef57948334c5c99154f244 (diff) |
Replace abs() by fabs()
Replace calls to abs() with floating arguments by calls to fabs(), to ensure the results are not accidentally truncated to integer.
Diffstat (limited to 'Carpet/CarpetLib/src/prolongate_3d_cc_enovol_rf2.cc')
-rw-r--r-- | Carpet/CarpetLib/src/prolongate_3d_cc_enovol_rf2.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Carpet/CarpetLib/src/prolongate_3d_cc_enovol_rf2.cc b/Carpet/CarpetLib/src/prolongate_3d_cc_enovol_rf2.cc index 45a6ad25b..1b230d387 100644 --- a/Carpet/CarpetLib/src/prolongate_3d_cc_enovol_rf2.cc +++ b/Carpet/CarpetLib/src/prolongate_3d_cc_enovol_rf2.cc @@ -153,7 +153,7 @@ namespace CarpetLib { RT const x1 = RT(0.5); //cout << "x0=" << x0 << endl; RT const y0 = (ipow (x1, n+1) - ipow (x0, n+1)) / ((x1-x0)*(n+1)); - if (not (abs (res - y0) < 1.0e-12)) { + if (not (fabs (res - y0) < 1.0e-12)) { RT rt; ostringstream buf; buf << "Error in prolongate_3d_cc_rf2::coeffs_3d_cc_rf2\n" @@ -224,7 +224,7 @@ namespace CarpetLib { { if (a * b < 0) return T(0); - else if (abs(a) < abs(b)) + else if (fabs(a) < fabs(b)) return a; else return b; @@ -285,7 +285,7 @@ namespace CarpetLib { } else { int min = 1; for (int i=0; i < 3; ++i) - if (abs(V[i]) < abs(V[min])) min = i; + if (fabs(V[i]) < fabs(V[min])) min = i; switch (min) { case 0: @@ -418,7 +418,7 @@ namespace CarpetLib { RT const x1 = di * RT(0.5) + RT(0.5); //cout << "x0=" << x0 << endl; RT const y0 = (ipow (x1, ORDER) - ipow (x0, ORDER)) / ((x1-x0)*(ORDER)); - if (not (abs (res - y0) < 1.0e-12)) { + if (not (fabs (res - y0) < 1.0e-12)) { RT rt; ostringstream buf; buf << "Error in prolongate_3d_cc_rf2::coeffs_3d_cc_rf2\n" |