1 #ifndef STAN_MATH_FWD_SCAL_FUN_TANH_HPP 2 #define STAN_MATH_FWD_SCAL_FUN_TANH_HPP 3 4 #include <stan/math/fwd/core.hpp> 5 6 namespace stan { 7 namespace math { 8 9 template <typename T> tanh(const fvar<T> & x)10inline fvar<T> tanh(const fvar<T>& x) { 11 using std::tanh; 12 T u = tanh(x.val_); 13 return fvar<T>(u, x.d_ * (1 - u * u)); 14 } 15 } // namespace math 16 } // namespace stan 17 #endif 18