Automatic Differentiation
 
Loading...
Searching...
No Matches

◆ tanh() [1/9]

template<typename T >
fvar< T > stan::math::tanh ( const fvar< T > &  x)
inline

Return the hyperbolic tangent of the argument.

For |x| >= 0.5 the derivative 1 - tanh(x)^2 is computed as 4 e / (1 + e)^2 with e = exp(-2 |x|), which neither cancels nor overflows.

Template Parameters
Tinner type of the forward-mode autodiff variable
Parameters
[in]xargument
Returns
hyperbolic tangent of the argument

Definition at line 27 of file tanh.hpp.