PLSQL | ATAN Function

The PLSQL ATAN function is used to return the arc tangent of a number. The ATAN function accepts only one parameter which is a number and the range accepted for the argument number is unbounded.

The ATAN function returns a value in the range of -pi/2 to pi/2, expressed in radians. 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.

Syntax:



ATAN( number )

Parameters Used:

number – It is used to specify the number whose arc tangent needs to be calculated.

Return Value:
The ATAN 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 a positive numeric value as an argument in the ATAN function.

DECLARE 
   Test_Number number := 0.5;
   
BEGIN 
   dbms_output.put_line(ATAN(Test_Number)); 
   
END; 

Output:

0.4636476090008061162142562314612144020295 

Example-2: Using a negative numeric value as an argument in the ATAN function.

DECLARE 
   Test_Number number := -0.5;
   
BEGIN 
   dbms_output.put_line(ASIN(Test_Number)); 
   
END;  

Output:

-0.4636476090008061162142562314612144020295 

Example-3: Using a numeric value which doesn’t fall in the range between -1 and 1 as an argument in the ATAN function.

DECLARE 
   Test_Number number := 2.5;
   
BEGIN 
   dbms_output.put_line(ATAN(Test_Number)); 
   
END;  

Output:


1.19028994968253173292773377482931773465 

Example-4: Using ATAN function with select query.

SELECT ATAN(.4) FROM dual; 

Output:

0.3805063771123649 

Example-5: Using ATAN function with select query and returning the value in degree.

select (ATAN(.4)) * 57.29  FROM dual; 

Output:

21.799210344767385 

Using the conversion formula of 1 radian = 57.29 degrees.

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



My Personal Notes arrow_drop_up

I am a technology enthusiast who has a keen interest in programming I am pursuing Engineering in Computer Science from GEU, Dehradun I like to unwind by watching movies and English sitcomsI have a keen interest in music

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.