Get Cosine Method
The Get Cosine method returns the cosine of an angle. The angle can be positive or negative. The return value is between negative 1 and 1. To convert degrees to radians, this method multiples the return value by (PI/180). The value of PI is approximately 3.14159.
Format
Cos(number)
The following table describes the arguments that you can use with this method.
Argument | Description |
---|---|
number |
An angle in radians. |
Example
The following example finds the length of a roof, given the roof pitch, and the distance of the house from the house center to the outside wall of the house:
Sub Button_Click
Dim bwidth As Single, roof As Single, pitch As Single
Dim msgtext
Const PI = 3.14159
Const conversion = PI/180
pitch = 35
pitch = Cos(pitch * conversion)
bwidth = 75
roof = bwidth/pitch
msgtext = "The length of the roof is " & _
Format(roof, "##.##") & " feet."
End Sub