1
0
Fork 0
mirror of https://github.com/bolero-MURAKAMI/Sprout synced 2025-08-03 12:49:50 +00:00

fix math functions

This commit is contained in:
bolero-MURAKAMI 2013-05-05 00:06:30 +09:00
parent ffb876c930
commit fccb16687b
20 changed files with 209 additions and 68 deletions

View file

@ -7,17 +7,26 @@
#include <sprout/math/detail/config.hpp>
#include <sprout/math/detail/float_compute.hpp>
#include <sprout/math/isnan.hpp>
#include <sprout/math/sinh.hpp>
#include <sprout/math/cosh.hpp>
#include <sprout/math/exp.hpp>
#include <sprout/type_traits/enabler_if.hpp>
namespace sprout {
namespace math {
namespace detail {
template<typename T>
inline SPROUT_CONSTEXPR T
tanh_impl_2(T t, T u) {
return (t - u) / (t + u);
}
template<typename T>
inline SPROUT_CONSTEXPR T
tanh_impl_1(T t) {
return sprout::math::detail::tanh_impl_2(t, T(1) / t);
}
template<typename T>
inline SPROUT_CONSTEXPR T
tanh_impl(T x) {
return sprout::math::sinh(x) / sprout::math::cosh(x);
return sprout::math::detail::tanh_impl_1(sprout::math::exp(x));
}
template<