diff --git a/Eigen/src/Core/SpecialFunctions.h b/Eigen/src/Core/SpecialFunctions.h index f90f1b81b..1de3d7f78 100644 --- a/Eigen/src/Core/SpecialFunctions.h +++ b/Eigen/src/Core/SpecialFunctions.h @@ -28,6 +28,13 @@ struct lgamma_impl } }; +template +struct lgamma_retval +{ + typedef Scalar type; +}; + +#ifdef EIGEN_HAS_C99_MATH template<> struct lgamma_impl { @@ -41,12 +48,7 @@ struct lgamma_impl EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE double run(const double& x) { return ::lgamma(x); } }; - -template -struct lgamma_retval -{ - typedef Scalar type; -}; +#endif /**************************************************************************** * Implementation of erf * @@ -63,6 +65,13 @@ struct erf_impl } }; +template +struct erf_retval +{ + typedef Scalar type; +}; + +#ifdef EIGEN_HAS_C99_MATH template<> struct erf_impl { @@ -76,12 +85,7 @@ struct erf_impl EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE double run(const double& x) { return ::erf(x); } }; - -template -struct erf_retval -{ - typedef Scalar type; -}; +#endif // EIGEN_HAS_C99_MATH /*************************************************************************** * Implementation of erfc * @@ -98,6 +102,13 @@ struct erfc_impl } }; +template +struct erfc_retval +{ + typedef Scalar type; +}; + +#ifdef EIGEN_HAS_C99_MATH template<> struct erfc_impl { @@ -111,15 +122,11 @@ struct erfc_impl EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE double run(const double x) { return ::erfc(x); } }; - -template -struct erfc_retval -{ - typedef Scalar type; -}; +#endif // EIGEN_HAS_C99_MATH } // end namespace internal + namespace numext { template diff --git a/test/packetmath.cpp b/test/packetmath.cpp index 758c2fb9d..91bb998d0 100644 --- a/test/packetmath.cpp +++ b/test/packetmath.cpp @@ -351,6 +351,7 @@ template void packetmath_real() VERIFY_IS_EQUAL(std::exp(-std::numeric_limits::denorm_min()), data2[1]); } +#ifdef EIGEN_HAS_C99_MATH { data1[0] = std::numeric_limits::quiet_NaN(); packet_helper::HasLGamma,Packet> h; @@ -369,6 +370,7 @@ template void packetmath_real() h.store(data2, internal::perfc(h.load(data1))); VERIFY((numext::isnan)(data2[0])); } +#endif // EIGEN_HAS_C99_MATH for (int i=0; i void packetmath_real() data1[internal::random(0, PacketSize)] = 0; CHECK_CWISE1_IF(PacketTraits::HasSqrt, std::sqrt, internal::psqrt); CHECK_CWISE1_IF(PacketTraits::HasLog, std::log, internal::plog); -#if __cplusplus > 199711L +#if defined(EIGEN_HAS_C99_MATH) && (__cplusplus > 199711L) CHECK_CWISE1_IF(internal::packet_traits::HasLGamma, std::lgamma, internal::plgamma); CHECK_CWISE1_IF(internal::packet_traits::HasErf, std::erf, internal::perf); CHECK_CWISE1_IF(internal::packet_traits::HasErfc, std::erfc, internal::perfc);