#ifndef SPROUT_MATH_CBRT_HPP #define SPROUT_MATH_CBRT_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 cbrt(FloatType x) { return x < 0 ? -sprout::math::detail::pow(-x, sprout::math::third()) : sprout::math::detail::pow(x, sprout::math::third()) ; } template< typename IntType, typename sprout::enabler_if::value>::type = sprout::enabler > inline SPROUT_CONSTEXPR double cbrt(IntType x) { return sprout::math::detail::cbrt(static_cast(x)); } } // namespace detail # if SPROUT_USE_BUILTIN_CMATH_FUNCTION using std::cbrt; # else using sprout::math::detail::cbrt; # endif } // namespace math using sprout::math::cbrt; } // namespace sprout #endif // #ifndef SPROUT_MATH_CBRT_HPP