PostgreSQL atan2d() 函数使用指南
PostgreSQL atan2d() 函数以度为单位返回指定的两个数除法运算的结果的反正切。
atan2d() 语法
这里是 PostgreSQL atan2d() 函数的语法:
atan2d(x, y)
参数
x- 必需的。 被除数。
y- 必需的。 除数。
返回值
PostgreSQL atan2d(x, y) 函数以度为单位返回 x/y 的反正切。
如果参数 number 为 NULL,atan2d() 函数将会返回 NULL。
atan2d() 示例
这里有几个 atan2d() 函数的示例。
SELECT
atan2d(1, 0) AS "atan2d(1, 0)",
atan2d(1, 2) AS "atan2d(1, 2)",
atan2d(0, 1) AS "atan2d(0, 1)";
-[ RECORD 1 ]+-------------------
atan2d(1, 0) | 90
atan2d(1, 2) | 26.565051177077986
atan2d(0, 1) | 0atan2d(x, y) 等同于 atand(x / y)。例如:
SELECT
atan2d(1, 2) AS "atan2d(1, 2)",
atand(0.5) AS "atand(0.5)";
-[ RECORD 1 ]+-------------------
atan2d(1, 2) | 26.565051177077986
atand(0.5) | 26.565051177077986这里,我们发现 atan2d(1, 2) 和 atand(0.5) 的结果相同。
atan2d(x, y) 等同于先运算 atan2(x, y),再将运算结果使用 degrees() 转为度数。例如:
SELECT
atan2d(1, 0) AS "atan2d(1, 0)",
degrees(atan2(1, 0)) AS "degrees(atan2(1, 0))";
-[ RECORD 1 ]--------+---
atan2d(1, 0) | 90
degrees(atan2(1, 0)) | 90