LibreOffice 7.3 Help

傳回數值型表示式反正切值的三角函式。傳回值在 -Pi/2 到 +Pi/2 之間。

The arctangent is the inverse of the tangent function. The Atn Function returns the angle "Alpha", expressed in radians, using the tangent of this angle. The function can also return the angle "Alpha" by comparing the ratio of the length of the side that is opposite of the angle to the length of the side that is adjacent to the angle in a right-angled triangle.

Atn(side opposite the angle/side adjacent to angle)= Alpha

```
Atn (Number As Double) As Double
```

Double

Number: Any numerical expression that represents the ratio of two sides of a right triangle. The Atn function returns the corresponding angle in radians (arctangent).

若要將弧度轉換成度，可將弧度乘以 180/pi。

度 = (弧度*180) /pi

弧度 = (度*pi)/180

Pi is here the fixed circle constant with the rounded value 3.14159. Pi is a Basic mathematical constant.

```
REM 以下示例用於直角三角形的計算
REM 依 Alpha 角的正切值來計算 Alpha 角：
Sub ExampleAtn
REM 捨入後的 PI = 3.1415926 是預先定義的常數
Dim d1 As Double
Dim d2 As Double
d1 = InputBox("Enter the length of the side adjacent to the angle:","Adjacent")
d2 = InputBox("Enter the length of the side opposite the angle:","Opposite")
Print "The Alpha angle is"; (atn (d2/d1) * 180 / Pi); " degrees"
End Sub
```