Main Tutorials

Oracle PL/SQL – ATAN and ATAN2 function example

This article show you how to use ATAN() and ATAN2() function in Oracle PL/SQL.

1. ATAN function examples

The ATAN function returns the arc tangent of n, the n can be in an unbounded range. The function will returns a value in the range of -pi/2 to pi/2, expressed in radians.


SELECT ATAN(1.5) FROM DUAL;
-- output
0.9827937232473290679857106110146660144997


SELECT ATAN(50) FROM DUAL;
-- output
1.55079899282174608617056849473815495415


SELECT ATAN(-5) FROM DUAL;
-- output
-1.37340076694501586086127192644496114865


SELECT ATAN(0) FROM DUAL;
-- output
0

2. ATAN2 function examples

The ATAN2 function returns the arc tangent of n1 and n2, both n1 and n2 can be in an unbounded range. The function will returns a value in the range of -pi to pi, depending on the signs of n1 and n2, expressed in radians.


SELECT ATAN2(-1,1) FROM DUAL;
-- output
-0.7853981633974483096156608458198757210546


SELECT ATAN2(50,100) FROM DUAL;
-- output
0.4636476090008061162142562314612144020295


SELECT ATAN2(0,0.5) FROM DUAL;
-- output
0

References

  1. ATAN Function :- Oracle official docs
  2. ATAN2 Function :- Oracle official docs

About Author

author image
Dhaval Dadhaniya is a software engineer by profession and reader/writter by passion. He is working in a well reputed MNC as an applications Developer with 5 years of experience. He have good understanding and knowledge of Java, Database, Spring, Hibernate and exploring other technologies related to Software development. Befriend him on Facebook

Comments

Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments