From 14248681cda8e33f580d4e192a5ff88f7d96cbd4 Mon Sep 17 00:00:00 2001 From: Christian Godenschwager Date: Mon, 5 Sep 2016 12:11:19 +0200 Subject: [PATCH 1/2] Added missing namespace log -> std::log --- exprtk.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exprtk.hpp b/exprtk.hpp index acfa85c..07054dd 100644 --- a/exprtk.hpp +++ b/exprtk.hpp @@ -1196,7 +1196,7 @@ namespace exprtk template inline T asin_impl(const T v, real_type_tag) { return std::asin (v); } template inline T asinh_impl(const T v, real_type_tag) { return std::log(v + std::sqrt((v * v) + T(1))); } template inline T atan_impl(const T v, real_type_tag) { return std::atan (v); } - template inline T atanh_impl(const T v, real_type_tag) { return (std::log(T(1) + v) - log(T(1) - v)) / T(2); } + template inline T atanh_impl(const T v, real_type_tag) { return (std::log(T(1) + v) - std::log(T(1) - v)) / T(2); } template inline T ceil_impl(const T v, real_type_tag) { return std::ceil (v); } template inline T cos_impl(const T v, real_type_tag) { return std::cos (v); } template inline T cosh_impl(const T v, real_type_tag) { return std::cosh (v); } From a636651f78869a806126d61e245d917159ef3c8d Mon Sep 17 00:00:00 2001 From: Christian Godenschwager Date: Mon, 5 Sep 2016 13:08:25 +0200 Subject: [PATCH 2/2] Fixed GCC conversion warning issued in erf and erfc functions with T=float --- exprtk.hpp | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/exprtk.hpp b/exprtk.hpp index 07054dd..2db92a2 100644 --- a/exprtk.hpp +++ b/exprtk.hpp @@ -1111,6 +1111,21 @@ namespace exprtk return T(0); } + inline float erf_dispatch( const float v ) + { + return ::erff( v ); + } + + inline double erf_dispatch( const double v ) + { + return ::erf( v ); + } + + inline long double erf_dispatch( const long double v ) + { + return ::erfl( v ); + } + template inline T erf_impl(T v, real_type_tag) { @@ -1135,7 +1150,7 @@ namespace exprtk return (v >= T(0)) ? result : -result; #else - return ::erf(v); + return erf_dispatch( v ); #endif } @@ -1144,6 +1159,21 @@ namespace exprtk { return erf_impl(static_cast(v),real_type_tag()); } + + inline float erfc_dispatch( const float v ) + { + return ::erfcf( v ); + } + + inline double erfc_dispatch( const double v ) + { + return ::erfc( v ); + } + + inline long double erfc_dispatch( const long double v ) + { + return ::erfcl( v ); + } template inline T erfc_impl(T v, real_type_tag) @@ -1151,7 +1181,7 @@ namespace exprtk #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) return T(1) - erf_impl(v,real_type_tag()); #else - return ::erfc(v); + return erfc_dispatch( v ); #endif }