ATN2 (Transact-SQL)

Applies to: yesSQL Server (all supported versions) YesAzure SQL Database YesAzure SQL Managed Instance yesAzure Synapse Analytics yesParallel Data Warehouse

Returns the angle, in radians, between the positive x-axis and the ray from the origin to the point (y, x), where x and y are the values of the two specified float expressions.

Topic link icon Transact-SQL Syntax Conventions

Syntax

ATN2 ( float_expression , float_expression )  

Note

To view Transact-SQL syntax for SQL Server 2014 and earlier, see Previous versions documentation.

Arguments

float_expression
An expression of data type float.

Return types

float

Examples

The following example calculates the ATN2 for the specified x and y components.

DECLARE @x FLOAT = 35.175643, @y FLOAT = 129.44;  
SELECT 'The ATN2 of the angle is: ' + CONVERT(VARCHAR, ATN2(@y, @x));  
GO  

Here is the result set.

The ATN2 of the angle is: 1.30545                         
(1 row(s) affected)  

See also

CAST and CONVERT (Transact-SQL)
float and real (Transact-SQL)
Mathematical Functions (Transact-SQL)