你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

atan2()

Applies to: ✅ Microsoft FabricAzure Data ExplorerAzure MonitorMicrosoft Sentinel

Calculates the angle, in radians, between the positive x-axis and the ray from the origin to the point (y, x).

Syntax

atan2(y,x)

Learn more about syntax conventions.

Parameters

Name Type Required Description
y real ✔️ The Y coordinate.
x real ✔️ The X coordinate.

Returns

Returns the angle in radians between the positive x-axis and the ray from the origin to the point (y, x).

Examples

The following example returns the angle measurements in radians.

print atan2_0 = atan2(1,1) // Pi / 4 radians (45 degrees)
| extend atan2_1 = atan2(0,-1) // Pi radians (180 degrees)
| extend atan2_2 = atan2(-1,0) // - Pi / 2 radians (-90 degrees)

Output

atan2_0 atan2_1 atan2_2
0.785398163397448 3.14159265358979 -1.5707963267949