TANH
Returns the hyperbolic tangent of a number. Result is always between -1 and 1.
TANH(number)Arguments
numberAny real number.
=TANH(0)TANH(0) is always 0
=TANH(2)Hyperbolic tangent of 2
- •TANH(x) = SINH(x) / COSH(x)
- •Result is always strictly between -1 and 1
- •Often used as activation function in neural networks
- •Confusing TANH with TAN - TANH is the hyperbolic tangent, unrelated to angles or the unit circle, while TAN is the regular trigonometric tangent based on an angle in radians and can produce very large or undefined values
- •Expecting TANH to reach exactly -1 or 1 for some finite input - it only approaches those bounds as the input approaches positive or negative infinity, never actually reaching them
- •Using TANH's output directly as a probability or percentage without remembering its range is -1 to 1, not 0 to 1 - a rescaling step is usually needed for that kind of use case
ATANHPerforms the inverse operation - calculates the inverse hyperbolic tangent, undoing what TANH calculates, for inputs between -1 and 1.SINHCalculates the hyperbolic sine, one of the two building blocks (along with hyperbolic cosine) that define TANH.COSHCalculates the hyperbolic cosine, the other building block of TANH's ratio (TANH(x) = SINH(x)/COSH(x)).What's the difference between TANH and TAN?
They're unrelated despite the similar name - TANH is the hyperbolic tangent, always staying strictly between -1 and 1, while TAN is the regular trigonometric tangent, which can produce very large values or become undefined at certain angles.
Can TANH ever equal exactly 1 or -1?
No, it only approaches those values as the input grows toward positive or negative infinity - the result is always strictly between -1 and 1.
Why is TANH commonly used in neural networks?
Its smooth, bounded S-shaped curve between -1 and 1 makes it a useful activation function for squashing values into a predictable range while still allowing for negative outputs, unlike some other activation functions.
Need to translate a formula using TANH?
Use our translator to convert your complete formula
