Open In App

PLSQL | COSH Function

Last Updated : 16 Feb, 2021
Improve
Improve
Like Article
Like
Save
Share
Report

The PLSQL COSH function is used to return the hyperbolic cosine of a numeric value. The COSH function accepts one parameter which is the number whose hyperbolic cosine needs to be calculated. The COSH 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 COSH function returns BINARY_DOUBLE. 

Syntax: 
 

COSH(number)

Parameters Used: 

number – It is used to specify the number whose hyperbolic cosine needs to be calculated. 

Return Value: 
The COSH 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 COSH function. 

 

DECLARE 
   Test_Number1 number := 0.5;
   
BEGIN 
   dbms_output.put_line(COSH(Test_Number1)); 
   
END; 

Output: 
 

1.12762596520638078522622516140267201257 

Example-2: Using 0 value as an argument in the COSH function. 

 

DECLARE 
   Test_Number1 number := 0;
   
BEGIN 
   dbms_output.put_line(COSH(Test_Number1)); 
   
END; 

Output: 
 

1 

Example-3: Using 1 value as an argument in the COSH function. 

 

DECLARE 
   Test_Number1 number := 1;
   
BEGIN 
   dbms_output.put_line(COSH(Test_Number1)); 
   
END;

Output: 
 

1.5430806348152437784779056207570616826 

Example-4: Using a negative value as an argument in the COSH function. 

 

DECLARE 
   Test_Number1 number := -5;
   
BEGIN 
   dbms_output.put_line(COSH(Test_Number1)); 
   
END; 

Output: 
 

74.20994852478784444410610804448771402388 

Example-5: Using COSH function with select query and returning the value in degrees. 

 

select (COSH(5)) * 57.29  FROM dual; 

Output: 
 

4251.48795 

Using the conversion formula of 1 radian = 57.29 degrees. 

Advantages: 
The COSH function accepts any numeric datatype as well as any non-numeric datatype as an argument that can be implicitly converted to a numeric datatype.
 


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads