©SQL :: Manager
HomeProgram InformationTechnical detailsFree downloadDonate for a cup of coffee
myway SQL Manager for MySQL and MariaDB, Download on Uptodown
SQL functionMySQLMariaDB

The ATAN2 SQL Function in MySQL and MariaDB - Arc-tangent calculation

ATAN2Syntax:ATAN2(Number [, Number2])
Return value:FLOAT
Synonyms:ATAN
Function type:Numeric function
Function Description

The ATAN2() function returns the arc-tangent of "Number". "Number" is the tangent of a radians.

If "Number2" is specified, the arctangent is calculated from both numbers.

It is similar to computing the arctangent of "Number" / "Number2" except that the signs of both arguments are used to determine the quadrant of the result.

As "Number2" 0 is allowed as a divider.

The DEGREES() function can be used to calculate the angle from a radians.

SQL Examples for the ATAN2 function

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20

select atan2(1.7320508075688767);
select degrees(atan2(1.7320508075688767));
select atan2(16331239353195368);
select degrees(atan2(16331239353195368));
select atan2(5443746451065123);
select degrees(atan2(5443746451065123));

select atan2(1.7320508075688767,2);
select degrees(atan2(1.7320508075688767,2));
select atan2(1.7320508075688767/2);
select degrees(atan2(1.7320508075688767/2));

select atan2(1.7320508075688767,1);
select degrees(atan2(1.7320508075688767,1));
select atan2(1.7320508075688767,0.5);
select degrees(atan2(1.7320508075688767,0.5));
select atan2(1.7320508075688767,-1);
select degrees(atan2(1.7320508075688767,-1));

atan2(1.7320508075688767)
double(23)
1.0471975511965976
degrees(atan2(1.7320508075688767))
double(23)
59.99999999999999
atan2(16331239353195368)
double(23)
1.5707963267948966
degrees(atan2(16331239353195368))
double(23)
90
atan2(5443746451065123)
double(23)
1.5707963267948963
degrees(atan2(5443746451065123))
double(23)
89.99999999999999
atan2(1.7320508075688767,2)
double(23)
0.7137243789447655
degrees(atan2(1.7320508075688767,2))
double(23)
40.8933946491309
atan2(1.7320508075688767/2)
double(23)
0.7137243789447655
degrees(atan2(1.7320508075688767/2))
double(23)
40.8933946491309
atan2(1.7320508075688767,1)
double(23)
1.0471975511965976
degrees(atan2(1.7320508075688767,1))
double(23)
59.99999999999999
atan2(1.7320508075688767,0.5)
double(23)
1.289761425292083
degrees(atan2(1.7320508075688767,0.5))
double(23)
73.89788624801399
atan2(1.7320508075688767,-1)
double(23)
2.0943951023931957
degrees(atan2(1.7320508075688767,-1))
double(23)
120.00000000000001
The examples were created with the MyWAY SQL manager: Download

How to use the ATAN2() function in MySQL and MariaDB databases

The ATAN2() function in MySQL and MariaDB is used in trigonometric calculations when the associated angle has to be determined using the x and y coordinates. This is particularly useful because the function can handle all four quadrants and avoids the ambiguity of the ATAN() function when only the quotient is known.
ASCIIASINATANATAN2AVGBENCHMARKBIN

Further MySQL und MariaDB SQL Numeric functions

BIT_COUNTBIT_COUNT(Integer)
More about BIT_COUNT Function

CEILCEIL(Number)
More about CEIL Function

CEILINGCEILING(Number)
More about CEILING Function

CRC32CRC32(String)
More about CRC32 Function

CRC32CCRC32C([Parameter], String)

FLOORFLOOR(Number)
More about FLOOR Function

SIGNSIGN(Number)
More about SIGN Function

ABSABS(Number)
More about ABS Function

ACOSACOS(Number)
More about ACOS Function

ASINASIN(Number)
More about ASIN Function

ATANATAN(Number [, Number2])
More about ATAN Function

COSCOS(Number)
More about COS Function

COTCOT(Number)
More about COT Function

DEGREESDEGREES(Number)
More about DEGREES Function

EXPEXP(Number)
More about EXP Function

LNLN(Number)
More about LN Function

LOGLOG([Base], Number)
More about LOG Function

LOG10LOG10(Number)
More about LOG10 Function

LOG2LOG2(Number)
More about LOG2 Function

MODMOD(Number, Divider)
More about MOD Function

POWPOW(Number, Exponent)
More about POW Function

POWERPOWER(Number, Exponent)
More about POWER Function

PIPI()
More about PI Function

RADIANSRADIANS(Number)
More about RADIANS Function

RANDRAND([Number])
More about RAND Function

ROUNDROUND(Number [, Decimals])
More about ROUND Function

SINSIN(Number)
More about SIN Function

SQRTSQRT(Number)
More about SQRT Function

TANTAN(Number)
More about TAN Function

TRUNCATETRUNCATE(Number, Decimals)
More about TRUNCATE Function

Numeric functionsString functionsRegular ExpressionsDate and Time functions
Comparison functionsEncryption & CompressionConversion functionsNULL functions
Aggregate functionsWindow functionsJSON functionsGeometric functions
Sequence functionsInformation functionsDynamic ColumnsMiscellaneous functions
More information about the ATAN2 SQL function: mysql.com and mariadb.com and w3schools.com
Updated: 2023-09-24ImprintContactTerms & conditionsPrivacy & CookiesUpdatesSitemapFacebookLinkedinTwitterStatistics©2020-2024 Heino Cunze-Fischer