#ifndef SPROUT_MATH_ATANH_HPP #define SPROUT_MATH_ATANH_HPP #include #include #include #include #include #if SPROUT_USE_BUILTIN_CMATH_FUNCTION # include #endif namespace sprout { namespace math { namespace detail { template< typename FloatType, typename sprout::enabler_if::value>::type = sprout::enabler > inline SPROUT_CONSTEXPR FloatType atanh(FloatType x) { return x < -1 || x > 1 ? std::numeric_limits::quiet_NaN() : x == -1 ? -std::numeric_limits::infinity() : x == 1 ? std::numeric_limits::infinity() : sprout::math::detail::log((1 + x) / (1 - x)) / 2 ; } template< typename IntType, typename sprout::enabler_if::value>::type = sprout::enabler > inline SPROUT_CONSTEXPR double atanh(IntType x) { return sprout::math::detail::atanh(static_cast(x)); } } // namespace detail # if SPROUT_USE_BUILTIN_CMATH_FUNCTION using std::atanh; # else using sprout::math::detail::atanh; # endif } // namespace math using sprout::math::atanh; } // namespace sprout #endif // #ifndef SPROUT_MATH_ATANH_HPP