tanh(): hyperbolic tangent
tanh(x) returns the hyperbolic tangent of x. Unlike ordinary tangent, its real output stays between −1 and 1.
Behavior
tanh(0) is 0. As x grows positive it approaches 1; as x grows negative it approaches −1. This smooth bounded behavior is useful in modeling and activation functions.
Related functions
Use atanh() for the inverse on the interval (−1, 1), and sinh() or cosh() for related hyperbolic functions. exp() underlies its exponential formula, while abs() checks magnitude.
Caveat
Do not confuse tanh with tan(); they have different geometry and domains.