The ATAN function in Oracle SQL is a trigonometric function that stands for Arc Tangent. It is the opposite of the TAN (Tangent) function. While TAN takes an angle and gives you a ratio, ATAN takes a ratio (which can be any number) and gives you back the angle.
The angle is returned in radians, which is the standard mathematical way to measure angles (as opposed to degrees).
What is the ATAN Function in Oracle?
The ATAN function is used to find the angle whose tangent is a given number.
- Input Range: The input number
ncan be any number (it is unbounded). - Output Range: The function returns the angle as a number in radians, which will always be between
-pi/2andpi/2(approximately -1.5708 to 1.5708).
This function is typically used in engineering, scientific, and mathematical calculations where you need to solve for an angle based on a known tangent ratio.
ATAN Function Syntax
The syntax for ATAN is very simple:
ATAN(n)
Let's break that down:
n: The number (or numeric column) for which you want to find the arc tangent.
Oracle ATAN Function Examples
Here are two practical examples of how to use ATAN.
Example 1: Finding the Arc Tangent of 1
In trigonometry, the tangent of a 45-degree angle is 1. In radians, 45 degrees is pi / 4 (approx 0.785). Let's see what ATAN returns.
Query:
SELECT
ATAN(1) AS "ArcTangent_of_1"
FROM DUAL;
Result:
ArcTangent_of_1
---------------
.785398163
This is the angle (in radians) whose tangent is 1.
Example 2: Finding the Arc Tangent of 0
The tangent of a 0-degree angle is 0.
Query:
SELECT
ATAN(0) AS "ArcTangent_of_0"
FROM DUAL;
Result:
ArcTangent_of_0
---------------
0
This is the angle (in radians) whose tangent is 0.
