diff options
author | Erik Schnetter <schnetter@cct.lsu.edu> | 2008-02-19 05:29:00 +0000 |
---|---|---|
committer | Erik Schnetter <schnetter@cct.lsu.edu> | 2008-02-19 05:29:00 +0000 |
commit | a54ac08d45123a6da430a848753fdb061cf6c0a3 (patch) | |
tree | 4b7da28dd961bb13bc3d34b33588939228049e2d /Carpet/CarpetMask/src | |
parent | 3ff1ad59325d5a9d61ab19df109659ad9c020d56 (diff) |
CarpetMask: Use atan2 correctly (avoid nans)
darcs-hash:20080219052909-dae7b-05cc048310f1feb1dca96f498493f5e75421ee60.gz
Diffstat (limited to 'Carpet/CarpetMask/src')
-rw-r--r-- | Carpet/CarpetMask/src/mask_surface.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Carpet/CarpetMask/src/mask_surface.cc b/Carpet/CarpetMask/src/mask_surface.cc index 990189a9f..a78a9f9f1 100644 --- a/Carpet/CarpetMask/src/mask_surface.cc +++ b/Carpet/CarpetMask/src/mask_surface.cc @@ -97,12 +97,14 @@ namespace CarpetMask { weight[ind] = 0.0; } else { CCTK_REAL const theta = - acos (min (+1.0, max (-1.0, dz / rho))); + acos (min (CCTK_REAL (+1.0), + max (CCTK_REAL (-1.0), dz / rho))); assert (not isnan (theta)); assert (theta >= 0); assert (theta <= M_PI); CCTK_REAL const phi = - fmod (atan2 (dy, dx) + 2 * M_PI, 2 * M_PI); + fmod (atan2 (dy, dx) + CCTK_REAL (2 * M_PI), + CCTK_REAL (2 * M_PI)); assert (not isnan (phi)); assert (phi >= 0); assert (phi < 2 * M_PI); |