From 491a9d1fa64821d2aedf2551edef4d37fe4ba6fc Mon Sep 17 00:00:00 2001 From: Ben Cumming <bcumming@cscs.ch> Date: Sat, 19 Mar 2016 06:45:45 +0100 Subject: [PATCH] add cmath header to fix os x compilation --- src/math.hpp | 2 +- tests/test_point.cpp | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/math.hpp b/src/math.hpp index d9368249..5c3a00b4 100644 --- a/src/math.hpp +++ b/src/math.hpp @@ -13,7 +13,7 @@ namespace nestmc { T area_frustrum(T L, T r1, T r2) { auto dr = r1 - r2; - return pi<double>() * (r1+r2) * sqrt(L*L + dr*dr); + return pi<double>() * (r1+r2) * std::sqrt(L*L + dr*dr); } template <typename T> diff --git a/tests/test_point.cpp b/tests/test_point.cpp index 9fbb62a2..f2499d42 100644 --- a/tests/test_point.cpp +++ b/tests/test_point.cpp @@ -1,4 +1,5 @@ #include <limits> +#include <cmath> #include "gtest.h" @@ -97,8 +98,8 @@ TEST(point, norm) point<double> p1(1, 1, 1); point<double> p2(1, 2, 3); - EXPECT_EQ(norm(p1), sqrt(3.)); - EXPECT_EQ(norm(p2), sqrt(1.+4.+9.)); + EXPECT_EQ(norm(p1), std::sqrt(3.)); + EXPECT_EQ(norm(p2), std::sqrt(1.+4.+9.)); } TEST(point, dot) -- GitLab