Cos
Returns the cosine of a number
Syntax
`
Declare Function Cos ( ByVal number As Double ) As Double
`
Usage
`
result = Cos( number )
`
Parameters
`number`
the angle (in radians)
Return Value
Returns the cosine of the argument `number` as a `Double` within the range of -1 to 1.
Description
The argument `number` is measured in radians (not degrees). The required `number` argument can be any valid numeric expression.
Example
`
Const PI As Double = 3.1415926535897932
Dim a As Double
Dim r As Double
Input "Please enter an angle in degrees: ", a
r = a * PI / 180 'Convert the degrees to Radians
Print ""
Print "The cosine of a" ; a; " degree angle is"; Cos ( r )
Sleep
`
Output:

    Please enter an angle in degrees: 30
    The cosine of a 30 degree angle Is 0.8660254037844387

Differences from QB

- None

See also

- `Acos`
- A Brief Introduction To Trigonometry