Tan Function

See Also37UFGX5              ExampleGUATBM>Low

Returns the tangent of an angle.

Syntax

Tan(angle)

Remarks

The argument angle can be any valid numeric expression71RISN measured in radians.

Tan takes an angle and returns the ratio of two sides of a right triangle. The ratio is the length of the side opposite an angle divided by the length of the side adjacent to the angle.

Tan returns a Double.  If the return value is too large, an Overflow error occurs.

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


See Also

Atn FunctionLANATN

Cos FunctionLANCOS

Sin FunctionLANSIN

Math FunctionsEK0VY1

Derived Math Functions3KO5YS8


Tan Function Example

The example uses Tan to calculate the tangent of an angle with a user-specified number of degrees.  To try this example, paste the code into the Declarations section of a form.  Then press F5 and click the form.

 

Sub Form_Click ()

   Dim Degrees, Msg, Pi, Radians               ' Declare variables.

   Pi = 4 * Atn(1)                             ' Calculate Pi.

   Degrees = InputBox("Enter an angle in degrees.")  ' Get user input.

   Radians = Degrees * (Pi / 180)              ' Convert to radians.

   Msg = "The tangent of a " & Degrees

   Msg = Msg & " degree angle is "

   Msg = Msg & Tan(Radians) & "."

   MsgBox Msg                                  ' Display results.

End Sub