Open In App

PLSQL | TANH Function

Last Updated : 25 Oct, 2019
Comments
Improve
Suggest changes
Like Article
Like
Report
The PLSQL TANH function is used to return the hyperbolic tangent of a numeric value. The TANH function accepts one parameter which is the number whose hyperbolic tangent needs to be calculated. The TANH function returns a value of the numeric data type. This function takes as an argument any numeric data type as well as any non-numeric data type that can be implicitly converted to a numeric data type. If in any case, the argument is BINARY_FLOAT, then the TANH function returns BINARY_DOUBLE. Syntax:
TANH(number)
Parameters Used: number - It is used to specify the number whose hyperbolic tangent needs to be calculated. Return Value: The TANH function in PLSQL returns a numeric value. Supported Versions of Oracle/PLSQL:
  1. Oracle 12c
  2. Oracle 11g
  3. Oracle 10g
  4. Oracle 9i
  5. Oracle 8i
Example-1: Using positive numeric value as an argument in the TANH function.
DECLARE 
   Test_Number1 number := 0.5;
   
BEGIN 
   dbms_output.put_line(TANH(Test_Number1)); 
   
END; 
Output:
0.462117157260009758502318483643672548721 
Example-2: Using 0 value as an argument in the TANH function.
DECLARE 
   Test_Number1 number := 0;
   
BEGIN 
   dbms_output.put_line(TANH(Test_Number1)); 
   
END;
Output:
0 
Example-3: Using 1 value as an argument in the TANH function.
DECLARE 
   Test_Number1 number := 1;
   
BEGIN 
   dbms_output.put_line(TANH(Test_Number1)); 
   
END; 
Output:
0.7615941559557648881194582826047935904163 
Example-4: Using a negative value as an argument in the TANH function.
DECLARE 
   Test_Number1 number := -5;
   
BEGIN 
   dbms_output.put_line(TANH(Test_Number1)); 
   
END;
Output:
-0.999909204262595131210990447534473021089 
Example-5: Using TANH function with select query and returning the value in degrees.
select (TANH(5)) * 57.29  FROM dual; 
Output:
57.2847983 
Using the conversion formula of 1 radian = 57.29 degrees. Advantages: The TANH function accepts any numeric datatype as well as any non-numeric datatype as an argument that can be implicitly converted to a numeric datatype.

Next Article
Article Tags :

Similar Reads