Contents
Index 🔎︎

# Cos Function

Calculates the cosine of an angle. The angle is specified in radians. The result lies in the range -1.0 to +1.0.

Using the angle Alpha, the Cos function calculates the ratio of the length of the side that is adjacent to the angle, divided by the length of the hypotenuse in a right-angled triangle.

Cos(Alpha) = Adjacent/Hypotenuse

### Syntax:

    Cos (Number As Double) As Double

### Return value:

Double

### Parameters:

Number: Numeric expression that specifies an angle in radians for which you want to calculate the cosine.

To convert degrees to radians, multiply degrees by Pi/180. To convert radians to degrees, multiply radians by 180/Pi.

degree=(radian*180)/Pi

radian=(degree*Pi)/180

Pi is here the fixed circle constant with the rounded value 3.14159...

### Error codes:

5 Invalid procedure call

### Example:

    ' The following example allows for a right-angled triangle the input of
    ' secant and angle (in degrees) and calculates the length of the hypotenuse:
    Sub ExampleCosinus
    ' rounded Pi = 3.1415926...
    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 hypotenuse is"; (d1 / cos (dAngle * Pi / 180))
    End Sub

Related Topics

Atn Function

Sin Function

Tan Function