计算一个角度的正切值,角度以弧度为单位。
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
Tan (Number As Double) As Double
Double
「数字」:要计算正切值的任意数字表达式 (以弧度为单位)。
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.
' 在此示例中,以下项均针对直角三角形:
' 角的对边和角度 (以度为单位),并根据它们来计算角的邻边长度:
Sub ExampleTangens
' 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("请输入 Alpha 角度 (单位为度):","Alpha")
Print "the length of the side adjacent the angle is"; (d1 / tan (dAlpha * Pi / 180))
End Sub