Bookshelf Home | Contents | Index | PDF

## Tan Function

This standard VB function returns the tangent of an angle in radians.

##### Syntax

Tan(number)

Argument
Description

number

A numeric expression containing the number of radians in the angle whose tangent is to be returned

##### Returns

The tangent of number.

##### Usage

Number is specified in radians and can be either positive or negative.

The return value is single precision if the angle is an integer, currency, or single-precision value; double precision for a long, variant, or double-precision value.

To convert degrees to radians, multiply by PI/180. The value of PI is 3.14159.

##### Example

This example finds the height of the exterior wall of a building, given its roof pitch and the length of the building.

Sub Button_Click
Dim bldglen, wallht
Dim pitch
Dim msgtext
Const PI = 3.14159
Const conversion = PI/180
On Error Resume Next
pitch = 35
pitch = pitch * conversion
bldglen = 150
wallht = Tan(pitch) * (bldglen/2)
End Sub