In SQLite, the atan() function calculates the arctangent of a number and returns the result in radians.
Syntax #
atan(x)
Arguments #
x
x is the number that you want to calculate the arc tangent. x can be a literal number, an expression, or a table column.
Return Type #
float
The atan() function returns the arc tangent of x in radians. It returns NULL if x is NULL.
If x is a string, the atan() function will convert it to a number before calculation. If the conversation fails, the atan() function returns NULL.
Examples #
The following example uses the atan() function to return the arc tan of zero:
SELECT atan(0) result;
Output:
result
------
0.0
The following example uses the atan() function to calculate the arc tangent of one:
SELECT atan(1) result;
Output:
result
------------------
0.7853981633974483
The result is in radians. If you want the result in degrees, you can use the degrees() function to convert it:
SELECT degrees(atan(1)) result;
Output:
result
------
45.0
It returns 45 degrees.
Thank you for your feedback!