Mono Class Library: System.Math Overview | Members

System.Math.Tan Method

Returns the tangent of the specified double that represents an angle.

public static double Tan (double a)

Parameters

a
A double that represents an angle measured in radians.

Returns

A double containing the value of the tangent of a. If a is equal to double.NaN, double.NegativeInfinity, or double.PositiveInfinity, returns double.NaN.

Remarks

Note: Multiply by pi/180 to convert degrees to radians.

Example

The following example demonstrates using the Math.Tan(double) method.

C# Example

using System;

public class MathTanExample
{

   public static void Main()
   {

      Double d1 = Math.Tan(0);
      Double d2 = Math.Tan(Math.PI/2.0);
      Console.WriteLine("Math.Tan(0) returns {0}", d1);
      Console.WriteLine("Math.Tan(Math.PI/2.0) returns {0}", d2);

   }

}

The output is

Math.Tan(0) returns 0
Math.Tan(Math.PI/2.0) returns 1.63317787283838E+16

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0