跳到主要内容

ATAN2

返回指定 x 和 y 坐标的反正切值,以弧度表示,范围在 -Pi 和 Pi 之间,不包括 -Pi。

语法

expression.ATAN2(arg1, arg2);

expression - 表示 ApiWorksheetFunction 类的变量。

参数

名称必需/可选数据类型默认值描述
arg1必需ApiRange | ApiName | number点的 x 坐标。
arg2必需ApiRange | ApiName | number点的 y 坐标。

返回值

number

示例

此示例演示如何返回指定 x 和 y 坐标的反正切,以弧度表示,范围在 -Pi 和 Pi 之间,不包括 -Pi。

// How to get an arctangent of the specified x and y coordinates.

// Use function to get an arctangent of the specified x and y coordinates in radians.

let worksheet = Api.GetActiveSheet();
let func = Api.WorksheetFunction;
worksheet.GetRange("A1").SetValue(func.ATAN2(1, -9));