IBM Lotus Symphony
|
计算一个角度的余弦值。角度以弧度指定。结果在 -1 到 1 之间。
以 Alpha 角为例,在直角三角形中 Cos 函数计算的是 Alpha 的邻边与斜边长度之比。
Cos(Alpha) = 邻边/斜边
Cos (Number)
双倍行距
Number:用于指定要计算余弦值的角度的数字表达式,以弧度为单位。
要将度转换为弧度,可将度乘以 pi/180。要将弧度转换为度,请将弧度乘以 180/pi。
度=(弧度*180) /pi
弧度=(度*pi) /180
Pi 在这里是修正后的圆周率常数,四舍五入后的值为 3.14159...
REM The following example allows for a right-angled triangle the input of
REM secant and angle (in degrees) and calculates the length of the hypotenuse:
Sub ExampleCosinus
REM rounded Pi = 3.14159
Dim d1 as Double, dAngle as Double
d1 = InputBox$ (""Enter the length of the adjacent side:","Adjacent")
dAngle = InputBox$ ("Enter the angle Alpha (in degrees) :","Alpha")
Print "The length of the hypothenuse is"; (d1 / cos (dAngle * Pi / 180) )
End Sub