T-SQL - ATAN() Function
The T-SQL (Transact-SQL) ATAN() function returns arc tangent of a value. The returned value will be in the range -𝜋/2 through 𝜋/2.
Note: ATAN() is the inverse of TAN().
Syntax
ATAN(x)
Parameters
x |
Required. Specify the value. |
Return Value
Returns the arc tangent of the value.
Example 1:
The example below shows the usage of ATAN() function.
SELECT ATAN(3); Result: 1.2490457723982544 SELECT ATAN(0.5); Result: 0.4636476090008061 SELECT ATAN(0); Result: 0 SELECT ATAN(-0.5); Result: -0.4636476090008061 SELECT ATAN(-3); Result: -1.2490457723982544
Example 2:
Consider a database table called Sample with the following records:
Data | x |
---|---|
Data 1 | -1 |
Data 2 | -0.5 |
Data 3 | 0 |
Data 4 | 0.5 |
Data 5 | 1 |
The statement given below can be used to calculate the arc tangent of records of column x.
SELECT *, ATAN(x) AS ATAN_Value FROM Sample;
This will produce the result as shown below:
Data | x | ATAN_Value |
---|---|---|
Data 1 | -1 | -0.7853981633974483 |
Data 2 | -0.5 | -0.4636476090008061 |
Data 3 | 0 | 0 |
Data 4 | 0.5 | 0.4636476090008061 |
Data 5 | 1 | 0.7853981633974483 |
❮ T-SQL Functions