From a54ac08d45123a6da430a848753fdb061cf6c0a3 Mon Sep 17 00:00:00 2001 From: Erik Schnetter Date: Tue, 19 Feb 2008 05:29:00 +0000 Subject: CarpetMask: Use atan2 correctly (avoid nans) darcs-hash:20080219052909-dae7b-05cc048310f1feb1dca96f498493f5e75421ee60.gz --- Carpet/CarpetMask/src/mask_surface.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'Carpet/CarpetMask') 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); -- cgit v1.2.3