diff --git a/tests/mesh/MeshPeRaytracing.cpp b/tests/mesh/MeshPeRaytracing.cpp
index 0cde05aa066621ae749391fa372a9757bd89f7b6..4f78824f2493e7681a79d472757dc1d2a7856f53 100644
--- a/tests/mesh/MeshPeRaytracing.cpp
+++ b/tests/mesh/MeshPeRaytracing.cpp
@@ -72,9 +72,9 @@ int CpRayIntersectionTest(const int resolution = 10)
       for (int y = 0; y < resolution; ++y)
       {
          const real_t rand2 = real_c(y) * dx;
-         real_t theta = 2 * M_PI * rand1;
-         real_t phi = acos(1 - 2 * rand2);
-         Vec3 dir(sin(phi) * cos(theta), sin(phi) * sin(theta), cos(phi));
+         real_t theta = real_t(2) * M_PI * rand1;
+         real_t phi = acos(real_t(1) - real_t(2) * rand2);
+         Vec3 dir(std::sin(phi) * std::cos(theta), std::sin(phi) * std::sin(theta), std::cos(phi));
 
          Ray ray( center + dir*real_t(5), -dir);
          real_t bx_t, cp_t;
@@ -94,11 +94,11 @@ int CpRayIntersectionTest(const int resolution = 10)
       for (int y = 0; y < resolution; ++y)
       {
          const real_t rand2 = real_c(y) * dx;
-         real_t theta = 2 * M_PI * rand1;
-         real_t phi = acos(1 - 2 * rand2);
-         Vec3 dir(sin(phi) * cos(theta), sin(phi) * sin(theta), cos(phi));
+         real_t theta = real_t(2) * M_PI * rand1;
+         real_t phi = acos(real_t(1) - real_t(2) * rand2);
+         Vec3 dir(std::sin(phi) * std::cos(theta), std::sin(phi) * std::sin(theta), std::cos(phi));
 
-         Ray ray( Vec3(5,5,5), -dir);
+         Ray ray( Vec3(real_t(5),real_t(5),real_t(5)), -dir);
          real_t bx_t, cp_t;
          Vec3   bx_n, cp_n;
          const bool bx_intersects = intersects(&bx, ray, bx_t, bx_n);