The Methods Defined by Math : Math Function « Development « C# / CSharp Tutorial






MethodMeaning
public static double Abs(double v)the absolute value.
public static float Abs(float v)the absolute value.
public static decimal Abs(decimal v)the absolute value.
public static int Abs(int v)the absolute value.
public static short Abs(short v)the absolute value.
public static long Abs(long v)the absolute value.
public static sbyte Abs(sbyte v)the absolute value.
public static double Acos(double v)the arc cosine. v must be between -1 and 1.
public static double Asin(double v)the arc sine. v must be between -1 and 1.
public static double Atan(double v)the arc tangent.
public static double Atan2(double y, double x)the arc tangent of y/x.
public static double Ceiling(double v)the smallest integer (represented as a floating-point value) not less than v. For example, given 1.02, Ceiling() returns 2.0. Given -1.02, Ceiling() returns -1.
public static double Cos(double v)the cosine.
public static double Cosh(double v)the hyperbolic cosine.
public static double Exp(double v)the natural logarithm base e raised to the v power.
public static double Floor(double v)the largest integer (represented as a floating-point value) not greater than v. For example, given 1.02, Floor() returns 1.0. Given -1.02, Floor() returns -2.
public static doubleIEEERemainder(double dividend,double divisor)Returns the remainder of dividend / divisor.
public static double Log(double v)the natural logarithm.
public static double Log(double v,double base)Returns the logarithm for v using base base.
public static double Log10(double v)Returns the base 10 logarithm for v.
public static double Max(double v1, double v2)Returns the greater of v1 and v2.
public static float Max(float v1, float v2)Returns the greater of v1 and v2.
public static decimal Max(decimal v1,decimal v2)Returns the greater of v1 and v2.
public static int Max(int v1, int v2)Returns the greater of v1 and v2.
public static short Max(short v1, short v2)Returns the greater of v1 and v2.
public static long Max(long v1, long v2)Returns the greater of v1 and v2.
public static uint Max(uint v1, uint v2)Returns the greater of v1 and v2.
public static ushort Max(ushort v1,ushort v2)Returns the greater of v1 and v2.
public static ulong Max(ulong v1,ulong v2)Returns the greater of v1 and v2.
public static byte Max(byte v1, byte v2)Returns the greater of v1 and v2.
public static sbyte Max(sbyte v1, sbyte v2)Returns the greater of v1 and v2.
public static double Min(double v1,double v2)Returns the lesser of v1 and v2.
public static float Min(float v1, float v2)Returns the lesser of v1 and v2.
public static decimal Min(decimal v1,decimal v2)Returns the lesser of v1 and v2.
public static int Min(int v1, int v2)Returns the lesser of v1 and v2.
public static short Min(short v1, short v2)Returns the lesser of v1 and v2.
public static long Min(long v1, long v2)Returns the lesser of v1 and v2.
public static uint Min(uint v1, uint v2)Returns the lesser of v1 and v2.
public static ushort Min(ushort v1,ushort v2)Returns the lesser of v1 and v2.
public static ulong Min(ulong v1, ulong v2)Returns the lesser of v1 and v2.
public static byte Min(byte v1, byte v2)Returns the lesser of v1 and v2.
public static sbyte Min(sbyte v1, sbyte v2)Returns the lesser of v1 and v2.
public static double Pow(double base,double exp)Returns base raised to the exp power(baseexp).
public static double Round(double v)Returns v rounded to the nearest whole number.
public static decimal Round(decimal v)Returns v rounded to the nearest whole number.
public static double Round(double v,int frac)Returns v rounded to the number of fractional digits specified by frac.
public static decimal Round(decimal v,int frac)Returns v rounded to the number of fractional digits specified by frac.
public static int Sign(double v)Returns -1 if v is less than zero, 0 if v is zero, and 1 if v is greater than zero.
public static int Sign(float v)Returns -1 if v is less than zero, 0 if v is zero, and 1 if v is greater than zero.
public static int Sign(decimal v)Returns -1 if v is less than zero, 0 if v is zero, and 1 if v is greater than zero.
public static int Sign(int v)Returns -1 if v is less than zero, 0 if v is zero, and 1 if v is greater than zero.
public static int Sign(short v)Returns -1 if v is less than zero, 0 if v is zero, and 1 if v is greater than zero.
public static int Sign(long v)Returns -1 if v is less than zero, 0 if v is zero, and 1 if v is greater than zero.
public static int Sign(sbyte v)Returns -1 if v is less than zero, 0 if v is zero, and 1 if v is greater than zero.
public static double Sin(double v)Returns the sine of v.
public static double Sinh(double v)Returns the hyperbolic sine of v.
public static double Sqrt(double v)Returns the square root of v.
public static double Tan(double v)Returns the tangent of v.
public static double Tanh(double v)Returns the hyperbolic tangent of v.










14.13.Math Function
14.13.1.Math defines several standard mathematical operations.
14.13.2.The Methods Defined by Math
14.13.3.Math functions in action
14.13.4.Math.Sin()
14.13.5.This example demonstrates Math.Sign()
14.13.6.This example demonstrates Math.Max()
14.13.7.Calculate the radius of a circle given its area using Math function
14.13.8.Math.Cos()
14.13.9.Math.Tan()