Tan Function

決定一個角度的正切值,角度以弧度做為單位指定。

Using the angle Alpha, the Tan function calculates the ratio of the length of the side opposite the angle to the length of the side adjacent to the angle in a right-angled triangle.

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

Syntax:


Tan (Number As Double) As Double

Return value:

Double

Parameters:

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

To convert degrees to radians, multiply by Pi/180. To convert radians to degrees, multiply by 180/Pi.

degrees=(radians*180)/Pi

radians=(degrees*Pi)/180

Pi is approximately 3.141593.

錯誤代碼:

5 無效的程序呼叫

Example:


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

Please support us!