Siebel VB Language Reference > VB Language Reference >
This standard VB function returns the cosine of an angle.
An angle in radians
The cosine of number.
The return value is between -1 and 1. The return value is a single-precision number if the angle has a data type of integer or currency, or is a single-precision value. The return value is a double-precision value if the angle has a data type of long or variant, or is a double-precision value.
The angle can be either positive or negative. To convert degrees to radians, multiply by (PI/180). The value of PI is approximately 3.14159.
This example finds the length of a roof, given its pitch and the distance of the house from its center to the outside wall.
Dim bwidth As Single, roof As Single, pitch As Single
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."
Derived Trigonometric Functions for Siebel VB