PostgreSQL ATAN2() function
ATAN2() function
The PostgreSQL atan2() function is used to return the inverse tangent of a division given in the argument.
Uses of ATAN2() Function
- Trigonometric Calculations: Calculate the arc tangent of the quotient of two values.
- Geometry: Determine the angle between two points in Cartesian coordinates.
- Engineering Applications: Perform calculations involving angles and vector directions.
- Scientific Research: Analyze data involving directional relationships and trigonometric functions.
Syntax:
atan2(b,a)
PostgreSQL Version: 9.3
Pictorial presentation of PostgreSQL ATAN2() function
Example 1: PostgreSQL ATAN2() function
Code:
SELECT ATAN2(0,1) AS "Atan2 (0,1)";
Sample Output:
Atan2 (0,1) ------------- 0 (1 row)
Example 2: PostgreSQL ATAN2() function
Code:
SELECT ATAN2(1,0) AS "Atan2 (1,0)";
Sample Output:
Atan2 (1,0) ----------------- 1.5707963267949 (1 row)
Example 3: PostgreSQL ATAN2() function
Code:
SELECT ATAN2(1,-1) AS "Atan2 (1,-1)";
Sample Output:
Atan2 (1,-1) ------------------ 2.35619449019234 (1 row)
Example 4: PostgreSQL ATAN2() function
Code:
SELECT ATAN2(-3,2) AS "Atan2 (-3,2)";
Sample Output:
Atan2 (-3,2) -------------------- -0.982793723247329 (1 row)
Previous: ATAN function
Next: CBRT function
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://www.w3resource.com/PostgreSQL/atan2-function.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics