Collabora Office 23.05 帮助
计算一个角度的正弦值,角度以弧度为单位,结果在 -1 到 1 之间。
Using the angle Alpha, the Sin function returns the ratio of the length of the opposite side of an angle to the length of the hypotenuse in a right-angled triangle.
Sin(Alpha) = side opposite the angle/hypotenuse
Sin (Number As Double) As Double
Double
「数字」: 用于指定要计算正弦值的角度的数字表达式,以弧度为单位。
To convert degrees to radians, multiply degrees by Pi/180, and to convert radians to degrees, multiply radians by 180/Pi.
degrees=(radians*180)/Pi
radians=(degrees*Pi)/180
Pi is approximately 3.141593.
' 在此示例中,以下项均针对直角三角形:
' 角的对边和角度 (以度为单位),并通过它们来计算斜边长度:
Sub ExampleSine
' Pi = 3.1415926 是一个预定义的变量
Dim d1 As Double
Dim dAlpha As Double
d1 = InputBox("输入对边长度: ","对边")
dAlpha = InputBox("Enter the angle Alpha (in degrees):","Alpha")
Print "The length of the hypotenuse is"; (d1 / sin (dAlpha * Pi / 180))
End Sub