From e751ee991bf23cb32db21c37d1fff8572af61550 Mon Sep 17 00:00:00 2001 From: jpekkila Date: Mon, 27 Jan 2020 17:04:14 +0200 Subject: [PATCH] Math operators are now using consistent precision throughout the project --- src/common/math_utils.h | 12 ++++++++---- src/core/kernels/kernels.cu | 4 ---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/common/math_utils.h b/src/common/math_utils.h index 472b55b..377ef59 100644 --- a/src/common/math_utils.h +++ b/src/common/math_utils.h @@ -25,12 +25,16 @@ * */ #pragma once -//#include -// using namespace std; // Potentially bad practice to declare namespace std here -#include // isnan, isinf // Overloads incorrect/bugged with GCC <= 6.0 -//#include // Even this does not work +#include // isnan, isinf #include // rand +#if AC_DOUBLE_PRECISION != 1 +#define exp(x) expf(x) +#define sin(x) sinf(x) +#define cos(x) cosf(x) +#define sqrt(x) sqrtf(x) +#endif + template static inline const T max(const T& a, const T& b) diff --git a/src/core/kernels/kernels.cu b/src/core/kernels/kernels.cu index fbcdd17..64fe8b3 100644 --- a/src/core/kernels/kernels.cu +++ b/src/core/kernels/kernels.cu @@ -68,10 +68,6 @@ typedef cuDoubleComplex acComplex; #else typedef cuFloatComplex acComplex; #define acComplex(x, y) make_cuFloatComplex(x, y) -#define exp(x) expf(x) -#define sin(x) sinf(x) -#define cos(x) cosf(x) -#define sqrt(x) sqrtf(x) #endif static __device__ inline acComplex