The TANH()
method in SQL returns the hyperbolic tangent of a parametric value. More precisely, it takes a double-precision number in arguments that specify the angle in radians. TANH()
returns the hyperbolic tangent of this specific angle.
Figure 1 illustrates the mathematical representation of the hyperbolic tangent method. Figure 2 demonstrates the graphical behavior of TANH()
between a -5 to +5
interval.
TANH(θ) //θ should be Radian angle
To convert degrees to radians, use this formula: Radian angle = Degree angle * π/180
The TANH()
method requires a double-precision number as an argument.
TANH()
returns the hyperbolic tangent (double-precision number) of the value that is sent as a parameter.
NULL
as a parameter, it will return NULL
.0
as an argument, it will return 0
.The following example illustrates how to use TANH(x)
in SQL and shows its behavior in different scenarios.
-- Example showing how to use TANH(x)/*Positive number*/SELECT TANH(2); -- return 0.9640275800758169/*Negative number*/select TANH(-1); -- return -0.7615941559557649/*Fractional number*/select TANH(0.6); -- return 0.5370495669980353