Lotus Symphony 1.2


Tan 函數 [執行時期]

確定一個角度的正切值。角度以弧度為單位傳回。

以 Alpha 角為例,在直角三角形中 Tan 函數計算 Alpha 的對邊與鄰邊長度之比。

Tan(Alpha) = 對邊/鄰邊

語法:

Tan (Number)

回覆值:

Double

參數:

Number:要計算正切值的任意數值表示式 (以弧度為單位)。

若要將度轉換成弧度,可將度乘以 Pi/180。若要將弧度轉換成度,可將弧度乘以 180/Pi。

度 = (弧度*180) /pi

弧度 = (度*pi)/180

Pi 的近似值是 3.141593。

錯誤代碼

5 無效的程序呼叫

範例:

REM 在此範例中,以下項目均可用於直角三角形:

REM 角的對邊和角度 (以度為單位),並計算角的鄰邊長度:

Sub ExampleTangens

REM Pi = 3.1415926 是預先定義的變數

Dim d1 as Double

Dim dAlpha as Double

d1 = InputBox$ ("Enter the length of the side opposite the angle: ","opposite")

dAlpha = InputBox$ ("Enter the Alpha angle (in degrees): ","Alpha")

Print "the length of the side adjacent the angle is"; (d1 / tan (dAlpha * Pi / 180))

End Sub


其他文件 | 商標