mscorlib(4.0.0.0) API with additions
System.Math Class Reference

Provides constants and static methods for trigonometric, logarithmic, and other common mathematical functions.To browse the .NET Framework source code for this type, see the Reference Source. More...

Public Member Functions

static double Acos (double d)
 Returns the angle whose cosine is the specified number. More...
 
static double Asin (double d)
 Returns the angle whose sine is the specified number. More...
 
static double Atan (double d)
 Returns the angle whose tangent is the specified number. More...
 
static double Atan2 (double y, double x)
 Returns the angle whose tangent is the quotient of two specified numbers. More...
 
static double Ceiling (double a)
 Returns the smallest integral value that is greater than or equal to the specified double-precision floating-point number. More...
 
static double Cos (double d)
 Returns the cosine of the specified angle. More...
 
static double Cosh (double value)
 Returns the hyperbolic cosine of the specified angle. More...
 
static double Floor (double d)
 Returns the largest integer less than or equal to the specified double-precision floating-point number. More...
 
static double Sin (double a)
 Returns the sine of the specified angle. More...
 
static double Tan (double a)
 Returns the tangent of the specified angle. More...
 
static double Sinh (double value)
 Returns the hyperbolic sine of the specified angle. More...
 
static double Tanh (double value)
 Returns the hyperbolic tangent of the specified angle. More...
 
static double Round (double a)
 Rounds a double-precision floating-point value to the nearest integral value. More...
 
static double Sqrt (double d)
 Returns the square root of a specified number. More...
 
static double Log (double d)
 Returns the natural (base e) logarithm of a specified number. More...
 
static double Log10 (double d)
 Returns the base 10 logarithm of a specified number. More...
 
static double Exp (double d)
 Returns e raised to the specified power. More...
 
static double Pow (double x, double y)
 Returns a specified number raised to the specified power. More...
 
static float Abs (float value)
 Returns the absolute value of a single-precision floating-point number. More...
 
static double Abs (double value)
 Returns the absolute value of a double-precision floating-point number. More...
 

Static Public Member Functions

static decimal Ceiling (decimal d)
 Returns the smallest integral value that is greater than or equal to the specified decimal number. More...
 
static decimal Floor (decimal d)
 Returns the largest integer less than or equal to the specified decimal number. More...
 
static double Round (double value, int digits)
 Rounds a double-precision floating-point value to a specified number of fractional digits. More...
 
static double Round (double value, MidpointRounding mode)
 Rounds a double-precision floating-point value to the nearest integer. A parameter specifies how to round the value if it is midway between two numbers. More...
 
static double Round (double value, int digits, MidpointRounding mode)
 Rounds a double-precision floating-point value to a specified number of fractional digits. A parameter specifies how to round the value if it is midway between two numbers. More...
 
static decimal Round (decimal d)
 Rounds a decimal value to the nearest integral value. More...
 
static decimal Round (decimal d, int decimals)
 Rounds a decimal value to a specified number of fractional digits. More...
 
static decimal Round (decimal d, MidpointRounding mode)
 Rounds a decimal value to the nearest integer. A parameter specifies how to round the value if it is midway between two numbers. More...
 
static decimal Round (decimal d, int decimals, MidpointRounding mode)
 Rounds a decimal value to a specified number of fractional digits. A parameter specifies how to round the value if it is midway between two numbers. More...
 
static decimal Truncate (decimal d)
 Calculates the integral part of a specified decimal number. More...
 
static double Truncate (double d)
 Calculates the integral part of a specified double-precision floating-point number. More...
 
static double IEEERemainder (double x, double y)
 Returns the remainder resulting from the division of a specified number by another specified number. More...
 
static sbyte Abs (sbyte value)
 Returns the absolute value of an 8-bit signed integer. More...
 
static short Abs (short value)
 Returns the absolute value of a 16-bit signed integer. More...
 
static int Abs (int value)
 Returns the absolute value of a 32-bit signed integer. More...
 
static long Abs (long value)
 Returns the absolute value of a 64-bit signed integer. More...
 
static decimal Abs (decimal value)
 Returns the absolute value of a T:System.Decimal number. More...
 
static sbyte Max (sbyte val1, sbyte val2)
 Returns the larger of two 8-bit signed integers. More...
 
static byte Max (byte val1, byte val2)
 Returns the larger of two 8-bit unsigned integers. More...
 
static short Max (short val1, short val2)
 Returns the larger of two 16-bit signed integers. More...
 
static ushort Max (ushort val1, ushort val2)
 Returns the larger of two 16-bit unsigned integers. More...
 
static int Max (int val1, int val2)
 Returns the larger of two 32-bit signed integers. More...
 
static uint Max (uint val1, uint val2)
 Returns the larger of two 32-bit unsigned integers. More...
 
static long Max (long val1, long val2)
 Returns the larger of two 64-bit signed integers. More...
 
static ulong Max (ulong val1, ulong val2)
 Returns the larger of two 64-bit unsigned integers. More...
 
static float Max (float val1, float val2)
 Returns the larger of two single-precision floating-point numbers. More...
 
static double Max (double val1, double val2)
 Returns the larger of two double-precision floating-point numbers. More...
 
static decimal Max (decimal val1, decimal val2)
 Returns the larger of two decimal numbers. More...
 
static sbyte Min (sbyte val1, sbyte val2)
 Returns the smaller of two 8-bit signed integers. More...
 
static byte Min (byte val1, byte val2)
 Returns the smaller of two 8-bit unsigned integers. More...
 
static short Min (short val1, short val2)
 Returns the smaller of two 16-bit signed integers. More...
 
static ushort Min (ushort val1, ushort val2)
 Returns the smaller of two 16-bit unsigned integers. More...
 
static int Min (int val1, int val2)
 Returns the smaller of two 32-bit signed integers. More...
 
static uint Min (uint val1, uint val2)
 Returns the smaller of two 32-bit unsigned integers. More...
 
static long Min (long val1, long val2)
 Returns the smaller of two 64-bit signed integers. More...
 
static ulong Min (ulong val1, ulong val2)
 Returns the smaller of two 64-bit unsigned integers. More...
 
static float Min (float val1, float val2)
 Returns the smaller of two single-precision floating-point numbers. More...
 
static double Min (double val1, double val2)
 Returns the smaller of two double-precision floating-point numbers. More...
 
static decimal Min (decimal val1, decimal val2)
 Returns the smaller of two decimal numbers. More...
 
static double Log (double a, double newBase)
 Returns the logarithm of a specified number in a specified base. More...
 
static int Sign (sbyte value)
 Returns an integer that indicates the sign of an 8-bit signed integer. More...
 
static int Sign (short value)
 Returns an integer that indicates the sign of a 16-bit signed integer. More...
 
static int Sign (int value)
 Returns an integer that indicates the sign of a 32-bit signed integer. More...
 
static int Sign (long value)
 Returns an integer that indicates the sign of a 64-bit signed integer. More...
 
static int Sign (float value)
 Returns an integer that indicates the sign of a single-precision floating-point number. More...
 
static int Sign (double value)
 Returns an integer that indicates the sign of a double-precision floating-point number. More...
 
static int Sign (decimal value)
 Returns an integer that indicates the sign of a decimal number. More...
 
static long BigMul (int a, int b)
 Produces the full product of two 32-bit numbers. More...
 
static int DivRem (int a, int b, out int result)
 Calculates the quotient of two 32-bit signed integers and also returns the remainder in an output parameter. More...
 
static long DivRem (long a, long b, out long result)
 Calculates the quotient of two 64-bit signed integers and also returns the remainder in an output parameter. More...
 

Public Attributes

const double PI = 3.1415926535897931
 Represents the ratio of the circumference of a circle to its diameter, specified by the constant, π. More...
 
const double E = 2.7182818284590451
 Represents the natural logarithmic base, specified by the constant, e. More...
 

Detailed Description

Provides constants and static methods for trigonometric, logarithmic, and other common mathematical functions.To browse the .NET Framework source code for this type, see the Reference Source.

Definition at line 10 of file Math.cs.

Member Function Documentation

◆ Abs() [1/7]

static sbyte System.Math.Abs ( sbyte  value)
static

Returns the absolute value of an 8-bit signed integer.

Parameters
valueA number that is greater than F:System.SByte.MinValue, but less than or equal to F:System.SByte.MaxValue.
Returns
An 8-bit signed integer, x, such that 0 ≤ x ≤F:System.SByte.MaxValue.
Exceptions
T:System.OverflowExceptionvalue equals F:System.SByte.MinValue.

Definition at line 458 of file Math.cs.

◆ Abs() [2/7]

static short System.Math.Abs ( short  value)
static

Returns the absolute value of a 16-bit signed integer.

Parameters
valueA number that is greater than F:System.Int16.MinValue, but less than or equal to F:System.Int16.MaxValue.
Returns
A 16-bit signed integer, x, such that 0 ≤ x ≤F:System.Int16.MaxValue.
Exceptions
T:System.OverflowExceptionvalue equals F:System.Int16.MinValue.

Definition at line 482 of file Math.cs.

◆ Abs() [3/7]

static int System.Math.Abs ( int  value)
static

Returns the absolute value of a 32-bit signed integer.

Parameters
valueA number that is greater than F:System.Int32.MinValue, but less than or equal to F:System.Int32.MaxValue.
Returns
A 32-bit signed integer, x, such that 0 ≤ x ≤F:System.Int32.MaxValue.
Exceptions
T:System.OverflowExceptionvalue equals F:System.Int32.MinValue.

Definition at line 506 of file Math.cs.

◆ Abs() [4/7]

static long System.Math.Abs ( long  value)
static

Returns the absolute value of a 64-bit signed integer.

Parameters
valueA number that is greater than F:System.Int64.MinValue, but less than or equal to F:System.Int64.MaxValue.
Returns
A 64-bit signed integer, x, such that 0 ≤ x ≤F:System.Int64.MaxValue.
Exceptions
T:System.OverflowExceptionvalue equals F:System.Int64.MinValue.

Definition at line 530 of file Math.cs.

◆ Abs() [5/7]

static float System.Math.Abs ( float  value)

Returns the absolute value of a single-precision floating-point number.

Parameters
valueA number that is greater than or equal to F:System.Single.MinValue, but less than or equal to F:System.Single.MaxValue.
Returns
A single-precision floating-point number, x, such that 0 ≤ x ≤F:System.Single.MaxValue.

◆ Abs() [6/7]

static double System.Math.Abs ( double  value)

Returns the absolute value of a double-precision floating-point number.

Parameters
valueA number that is greater than or equal to F:System.Double.MinValue, but less than or equal to F:System.Double.MaxValue.
Returns
A double-precision floating-point number, x, such that 0 ≤ x ≤F:System.Double.MaxValue.

◆ Abs() [7/7]

static decimal System.Math.Abs ( decimal  value)
static

Returns the absolute value of a T:System.Decimal number.

Parameters
valueA number that is greater than or equal to F:System.Decimal.MinValue, but less than or equal to F:System.Decimal.MaxValue.
Returns
A decimal number, x, such that 0 ≤ x ≤F:System.Decimal.MaxValue.

Definition at line 568 of file Math.cs.

◆ Acos()

static double System.Math.Acos ( double  d)

Returns the angle whose cosine is the specified number.

Parameters
dA number representing a cosine, where d must be greater than or equal to -1, but less than or equal to 1.
Returns
An angle, θ, measured in radians, such that 0 ≤θ≤π-or- F:System.Double.NaN if d < -1 or d > 1 or d equals F:System.Double.NaN.

◆ Asin()

static double System.Math.Asin ( double  d)

Returns the angle whose sine is the specified number.

Parameters
dA number representing a sine, where d must be greater than or equal to -1, but less than or equal to 1.
Returns
An angle, θ, measured in radians, such that -π/2 ≤θ≤π/2 -or- F:System.Double.NaN if d < -1 or d > 1 or d equals F:System.Double.NaN.

◆ Atan()

static double System.Math.Atan ( double  d)

Returns the angle whose tangent is the specified number.

Parameters
dA number representing a tangent.
Returns
An angle, θ, measured in radians, such that -π/2 ≤θ≤π/2.-or- F:System.Double.NaN if d equals F:System.Double.NaN, -π/2 rounded to double precision (-1.5707963267949) if d equals F:System.Double.NegativeInfinity, or π/2 rounded to double precision (1.5707963267949) if d equals F:System.Double.PositiveInfinity.

◆ Atan2()

static double System.Math.Atan2 ( double  y,
double  x 
)

Returns the angle whose tangent is the quotient of two specified numbers.

Parameters
yThe y coordinate of a point.
xThe x coordinate of a point.
Returns
An angle, θ, measured in radians, such that -π≤θ≤π, and tan(θ) = y / x , where (x , y ) is a point in the Cartesian plane. Observe the following: For (x , y ) in quadrant 1, 0 < θ < π/2.For (x , y ) in quadrant 2, π/2 < θ≤π.For (x , y ) in quadrant 3, -π < θ < -π/2.For (x , y ) in quadrant 4, -π/2 < θ < 0. For points on the boundaries of the quadrants, the return value is the following:If y is 0 and x is not negative, θ = 0.If y is 0 and x is negative, θ = π.If y is positive and x is 0, θ = π/2.If y is negative and x is 0, θ = -π/2. If y is 0 and x is 0, θ = 0. If x or y is F:System.Double.NaN, or if x and y are either F:System.Double.PositiveInfinity or F:System.Double.NegativeInfinity, the method returns F:System.Double.NaN.

◆ BigMul()

static long System.Math.BigMul ( int  a,
int  b 
)
static

Produces the full product of two 32-bit numbers.

Parameters
aThe first number to multiply.
bThe second number to multiply.
Returns
The number containing the product of the specified numbers.

Definition at line 1147 of file Math.cs.

◆ Ceiling() [1/2]

static decimal System.Math.Ceiling ( decimal  d)
static

Returns the smallest integral value that is greater than or equal to the specified decimal number.

Parameters
dA decimal number.
Returns
The smallest integral value that is greater than or equal to d . Note that this method returns a T:System.Decimal instead of an integral type.

Definition at line 86 of file Math.cs.

◆ Ceiling() [2/2]

static double System.Math.Ceiling ( double  a)

Returns the smallest integral value that is greater than or equal to the specified double-precision floating-point number.

Parameters
aA double-precision floating-point number.
Returns
The smallest integral value that is greater than or equal to a . If a is equal to F:System.Double.NaN, F:System.Double.NegativeInfinity, or F:System.Double.PositiveInfinity, that value is returned. Note that this method returns a T:System.Double instead of an integral type.

◆ Cos()

static double System.Math.Cos ( double  d)

Returns the cosine of the specified angle.

Parameters
dAn angle, measured in radians.
Returns
The cosine of d . If d is equal to F:System.Double.NaN, F:System.Double.NegativeInfinity, or F:System.Double.PositiveInfinity, this method returns F:System.Double.NaN.

◆ Cosh()

static double System.Math.Cosh ( double  value)

Returns the hyperbolic cosine of the specified angle.

Parameters
valueAn angle, measured in radians.
Returns
The hyperbolic cosine of value . If value is equal to F:System.Double.NegativeInfinity or F:System.Double.PositiveInfinity, F:System.Double.PositiveInfinity is returned. If value is equal to F:System.Double.NaN, F:System.Double.NaN is returned.

◆ DivRem() [1/2]

static int System.Math.DivRem ( int  a,
int  b,
out int  result 
)
static

Calculates the quotient of two 32-bit signed integers and also returns the remainder in an output parameter.

Parameters
aThe dividend.
bThe divisor.
resultThe remainder.
Returns
The quotient of the specified numbers.
Exceptions
T:System.DivideByZeroExceptionb is zero.

Definition at line 1159 of file Math.cs.

◆ DivRem() [2/2]

static long System.Math.DivRem ( long  a,
long  b,
out long  result 
)
static

Calculates the quotient of two 64-bit signed integers and also returns the remainder in an output parameter.

Parameters
aThe dividend.
bThe divisor.
resultThe remainder.
Returns
The quotient of the specified numbers.
Exceptions
T:System.DivideByZeroExceptionb is zero.

Definition at line 1172 of file Math.cs.

◆ Exp()

static double System.Math.Exp ( double  d)

Returns e raised to the specified power.

Parameters
dA number specifying a power.
Returns
The number e raised to the power d . If d equals F:System.Double.NaN or F:System.Double.PositiveInfinity, that value is returned. If d equals F:System.Double.NegativeInfinity, 0 is returned.

◆ Floor() [1/2]

static decimal System.Math.Floor ( decimal  d)
static

Returns the largest integer less than or equal to the specified decimal number.

Parameters
dA decimal number.
Returns
The largest integer less than or equal to d . Note that the method returns an integral value of type T:System.Math.

Definition at line 119 of file Math.cs.

◆ Floor() [2/2]

static double System.Math.Floor ( double  d)

Returns the largest integer less than or equal to the specified double-precision floating-point number.

Parameters
dA double-precision floating-point number.
Returns
The largest integer less than or equal to d . If d is equal to F:System.Double.NaN, F:System.Double.NegativeInfinity, or F:System.Double.PositiveInfinity, that value is returned.

◆ IEEERemainder()

static double System.Math.IEEERemainder ( double  x,
double  y 
)
static

Returns the remainder resulting from the division of a specified number by another specified number.

Parameters
xA dividend.
yA divisor.
Returns
A number equal to x - (y Q), where Q is the quotient of x / y rounded to the nearest integer (if x / y falls halfway between two integers, the even integer is returned).If x - (y Q) is zero, the value +0 is returned if x is positive, or -0 if x is negative.If y = 0, F:System.Double.NaN is returned.

Definition at line 414 of file Math.cs.

◆ Log() [1/2]

static double System.Math.Log ( double  d)

Returns the natural (base e) logarithm of a specified number.

Parameters
dThe number whose logarithm is to be found.
Returns
One of the values in the following table. d parameterReturn value Positive The natural logarithm of d ; that is, ln d , or log ed Zero F:System.Double.NegativeInfinity Negative F:System.Double.NaN Equal to F:System.Double.NaN F:System.Double.NaN Equal to F:System.Double.PositiveInfinity F:System.Double.PositiveInfinity

◆ Log() [2/2]

static double System.Math.Log ( double  a,
double  newBase 
)
static

Returns the logarithm of a specified number in a specified base.

Parameters
aThe number whose logarithm is to be found.
newBaseThe base of the logarithm.
Returns

One of the values in the following table. (+Infinity denotes F:System.Double.PositiveInfinity, -Infinity denotes F:System.Double.NegativeInfinity, and NaN denotes F:System.Double.NaN.) a

newBase Return value a > 0(0 <newBase < 1) -or-(newBase > 1)lognewBase(a) a < 0(any value)NaN(any value) newBase < 0NaN a != 1 newBase = 0NaN a != 1 newBase = +InfinityNaN a = NaN(any value)NaN(any value) newBase = NaNNaN(any value) newBase = 1NaN a = 00 <newBase < 1 +Infinity a = 0 newBase > 1-Infinity a = +Infinity0 <newBase < 1-Infinity a = +Infinity newBase > 1+Infinity a = 1 newBase = 00 a = 1 newBase = +Infinity0

Definition at line 969 of file Math.cs.

◆ Log10()

static double System.Math.Log10 ( double  d)

Returns the base 10 logarithm of a specified number.

Parameters
dA number whose logarithm is to be found.
Returns
One of the values in the following table. d parameter Return value Positive The base 10 log of d ; that is, log 10d . Zero F:System.Double.NegativeInfinity Negative F:System.Double.NaN Equal to F:System.Double.NaN F:System.Double.NaN Equal to F:System.Double.PositiveInfinity F:System.Double.PositiveInfinity

◆ Max() [1/11]

static sbyte System.Math.Max ( sbyte  val1,
sbyte  val2 
)
static

Returns the larger of two 8-bit signed integers.

Parameters
val1The first of two 8-bit signed integers to compare.
val2The second of two 8-bit signed integers to compare.
Returns
Parameter val1 or val2 , whichever is larger.

Definition at line 581 of file Math.cs.

◆ Max() [2/11]

static byte System.Math.Max ( byte  val1,
byte  val2 
)
static

Returns the larger of two 8-bit unsigned integers.

Parameters
val1The first of two 8-bit unsigned integers to compare.
val2The second of two 8-bit unsigned integers to compare.
Returns
Parameter val1 or val2 , whichever is larger.

Definition at line 597 of file Math.cs.

◆ Max() [3/11]

static short System.Math.Max ( short  val1,
short  val2 
)
static

Returns the larger of two 16-bit signed integers.

Parameters
val1The first of two 16-bit signed integers to compare.
val2The second of two 16-bit signed integers to compare.
Returns
Parameter val1 or val2 , whichever is larger.

Definition at line 613 of file Math.cs.

◆ Max() [4/11]

static ushort System.Math.Max ( ushort  val1,
ushort  val2 
)
static

Returns the larger of two 16-bit unsigned integers.

Parameters
val1The first of two 16-bit unsigned integers to compare.
val2The second of two 16-bit unsigned integers to compare.
Returns
Parameter val1 or val2 , whichever is larger.

Definition at line 630 of file Math.cs.

◆ Max() [5/11]

static int System.Math.Max ( int  val1,
int  val2 
)
static

Returns the larger of two 32-bit signed integers.

Parameters
val1The first of two 32-bit signed integers to compare.
val2The second of two 32-bit signed integers to compare.
Returns
Parameter val1 or val2 , whichever is larger.

Definition at line 646 of file Math.cs.

◆ Max() [6/11]

static uint System.Math.Max ( uint  val1,
uint  val2 
)
static

Returns the larger of two 32-bit unsigned integers.

Parameters
val1The first of two 32-bit unsigned integers to compare.
val2The second of two 32-bit unsigned integers to compare.
Returns
Parameter val1 or val2 , whichever is larger.

Definition at line 663 of file Math.cs.

◆ Max() [7/11]

static long System.Math.Max ( long  val1,
long  val2 
)
static

Returns the larger of two 64-bit signed integers.

Parameters
val1The first of two 64-bit signed integers to compare.
val2The second of two 64-bit signed integers to compare.
Returns
Parameter val1 or val2 , whichever is larger.

Definition at line 679 of file Math.cs.

◆ Max() [8/11]

static ulong System.Math.Max ( ulong  val1,
ulong  val2 
)
static

Returns the larger of two 64-bit unsigned integers.

Parameters
val1The first of two 64-bit unsigned integers to compare.
val2The second of two 64-bit unsigned integers to compare.
Returns
Parameter val1 or val2 , whichever is larger.

Definition at line 696 of file Math.cs.

◆ Max() [9/11]

static float System.Math.Max ( float  val1,
float  val2 
)
static

Returns the larger of two single-precision floating-point numbers.

Parameters
val1The first of two single-precision floating-point numbers to compare.
val2The second of two single-precision floating-point numbers to compare.
Returns
Parameter val1 or val2 , whichever is larger. If val1 , or val2 , or both val1 and val2 are equal to F:System.Single.NaN, F:System.Single.NaN is returned.

Definition at line 711 of file Math.cs.

◆ Max() [10/11]

static double System.Math.Max ( double  val1,
double  val2 
)
static

Returns the larger of two double-precision floating-point numbers.

Parameters
val1The first of two double-precision floating-point numbers to compare.
val2The second of two double-precision floating-point numbers to compare.
Returns
Parameter val1 or val2 , whichever is larger. If val1 , val2 , or both val1 and val2 are equal to F:System.Double.NaN, F:System.Double.NaN is returned.

Definition at line 730 of file Math.cs.

◆ Max() [11/11]

static decimal System.Math.Max ( decimal  val1,
decimal  val2 
)
static

Returns the larger of two decimal numbers.

Parameters
val1The first of two decimal numbers to compare.
val2The second of two decimal numbers to compare.
Returns
Parameter val1 or val2 , whichever is larger.

Definition at line 749 of file Math.cs.

◆ Min() [1/11]

static sbyte System.Math.Min ( sbyte  val1,
sbyte  val2 
)
static

Returns the smaller of two 8-bit signed integers.

Parameters
val1The first of two 8-bit signed integers to compare.
val2The second of two 8-bit signed integers to compare.
Returns
Parameter val1 or val2 , whichever is smaller.

Definition at line 762 of file Math.cs.

◆ Min() [2/11]

static byte System.Math.Min ( byte  val1,
byte  val2 
)
static

Returns the smaller of two 8-bit unsigned integers.

Parameters
val1The first of two 8-bit unsigned integers to compare.
val2The second of two 8-bit unsigned integers to compare.
Returns
Parameter val1 or val2 , whichever is smaller.

Definition at line 778 of file Math.cs.

◆ Min() [3/11]

static short System.Math.Min ( short  val1,
short  val2 
)
static

Returns the smaller of two 16-bit signed integers.

Parameters
val1The first of two 16-bit signed integers to compare.
val2The second of two 16-bit signed integers to compare.
Returns
Parameter val1 or val2 , whichever is smaller.

Definition at line 794 of file Math.cs.

◆ Min() [4/11]

static ushort System.Math.Min ( ushort  val1,
ushort  val2 
)
static

Returns the smaller of two 16-bit unsigned integers.

Parameters
val1The first of two 16-bit unsigned integers to compare.
val2The second of two 16-bit unsigned integers to compare.
Returns
Parameter val1 or val2 , whichever is smaller.

Definition at line 811 of file Math.cs.

◆ Min() [5/11]

static int System.Math.Min ( int  val1,
int  val2 
)
static

Returns the smaller of two 32-bit signed integers.

Parameters
val1The first of two 32-bit signed integers to compare.
val2The second of two 32-bit signed integers to compare.
Returns
Parameter val1 or val2 , whichever is smaller.

Definition at line 827 of file Math.cs.

◆ Min() [6/11]

static uint System.Math.Min ( uint  val1,
uint  val2 
)
static

Returns the smaller of two 32-bit unsigned integers.

Parameters
val1The first of two 32-bit unsigned integers to compare.
val2The second of two 32-bit unsigned integers to compare.
Returns
Parameter val1 or val2 , whichever is smaller.

Definition at line 844 of file Math.cs.

◆ Min() [7/11]

static long System.Math.Min ( long  val1,
long  val2 
)
static

Returns the smaller of two 64-bit signed integers.

Parameters
val1The first of two 64-bit signed integers to compare.
val2The second of two 64-bit signed integers to compare.
Returns
Parameter val1 or val2 , whichever is smaller.

Definition at line 860 of file Math.cs.

◆ Min() [8/11]

static ulong System.Math.Min ( ulong  val1,
ulong  val2 
)
static

Returns the smaller of two 64-bit unsigned integers.

Parameters
val1The first of two 64-bit unsigned integers to compare.
val2The second of two 64-bit unsigned integers to compare.
Returns
Parameter val1 or val2 , whichever is smaller.

Definition at line 877 of file Math.cs.

◆ Min() [9/11]

static float System.Math.Min ( float  val1,
float  val2 
)
static

Returns the smaller of two single-precision floating-point numbers.

Parameters
val1The first of two single-precision floating-point numbers to compare.
val2The second of two single-precision floating-point numbers to compare.
Returns
Parameter val1 or val2 , whichever is smaller. If val1 , val2 , or both val1 and val2 are equal to F:System.Single.NaN, F:System.Single.NaN is returned.

Definition at line 892 of file Math.cs.

◆ Min() [10/11]

static double System.Math.Min ( double  val1,
double  val2 
)
static

Returns the smaller of two double-precision floating-point numbers.

Parameters
val1The first of two double-precision floating-point numbers to compare.
val2The second of two double-precision floating-point numbers to compare.
Returns
Parameter val1 or val2 , whichever is smaller. If val1 , val2 , or both val1 and val2 are equal to F:System.Double.NaN, F:System.Double.NaN is returned.

Definition at line 911 of file Math.cs.

◆ Min() [11/11]

static decimal System.Math.Min ( decimal  val1,
decimal  val2 
)
static

Returns the smaller of two decimal numbers.

Parameters
val1The first of two decimal numbers to compare.
val2The second of two decimal numbers to compare.
Returns
Parameter val1 or val2 , whichever is smaller.

Definition at line 930 of file Math.cs.

◆ Pow()

static double System.Math.Pow ( double  x,
double  y 
)

Returns a specified number raised to the specified power.

Parameters
xA double-precision floating-point number to be raised to a power.
yA double-precision floating-point number that specifies a power.
Returns
The number x raised to the power y .

◆ Round() [1/8]

static double System.Math.Round ( double  a)

Rounds a double-precision floating-point value to the nearest integral value.

Parameters
aA double-precision floating-point number to be rounded.
Returns
The integer nearest a . If the fractional component of a is halfway between two integers, one of which is even and the other odd, then the even number is returned. Note that this method returns a T:System.Double instead of an integral type.

◆ Round() [2/8]

static double System.Math.Round ( double  value,
int  digits 
)
static

Rounds a double-precision floating-point value to a specified number of fractional digits.

Parameters
valueA double-precision floating-point number to be rounded.
digitsThe number of fractional digits in the return value.
Returns
The number nearest to value that contains a number of fractional digits equal to digits .
Exceptions
T:System.ArgumentOutOfRangeExceptiondigits is less than 0 or greater than 15.

Definition at line 210 of file Math.cs.

◆ Round() [3/8]

static double System.Math.Round ( double  value,
MidpointRounding  mode 
)
static

Rounds a double-precision floating-point value to the nearest integer. A parameter specifies how to round the value if it is midway between two numbers.

Parameters
valueA double-precision floating-point number to be rounded.
modeSpecification for how to round value if it is midway between two other numbers.
Returns
The integer nearest value . If value is halfway between two integers, one of which is even and the other odd, then mode determines which of the two is returned.
Exceptions
T:System.ArgumentExceptionmode is not a valid value of T:System.MidpointRounding.

Definition at line 226 of file Math.cs.

◆ Round() [4/8]

static double System.Math.Round ( double  value,
int  digits,
MidpointRounding  mode 
)
static

Rounds a double-precision floating-point value to a specified number of fractional digits. A parameter specifies how to round the value if it is midway between two numbers.

Parameters
valueA double-precision floating-point number to be rounded.
digitsThe number of fractional digits in the return value.
modeSpecification for how to round value if it is midway between two other numbers.
Returns
The number nearest to value that has a number of fractional digits equal to digits . If value has fewer fractional digits than digits , value is returned unchanged.
Exceptions
T:System.ArgumentOutOfRangeExceptiondigits is less than 0 or greater than 15.
T:System.ArgumentExceptionmode is not a valid value of T:System.MidpointRounding.

Definition at line 241 of file Math.cs.

◆ Round() [5/8]

static decimal System.Math.Round ( decimal  d)
static

Rounds a decimal value to the nearest integral value.

Parameters
dA decimal number to be rounded.
Returns
The integer nearest parameter d . If the fractional component of d is halfway between two integers, one of which is even and the other odd, the even number is returned. Note that this method returns a T:System.Decimal instead of an integral type.
Exceptions
T:System.OverflowExceptionThe result is outside the range of a T:System.Decimal.

Definition at line 259 of file Math.cs.

◆ Round() [6/8]

static decimal System.Math.Round ( decimal  d,
int  decimals 
)
static

Rounds a decimal value to a specified number of fractional digits.

Parameters
dA decimal number to be rounded.
decimalsThe number of decimal places in the return value.
Returns
The number nearest to d that contains a number of fractional digits equal to decimals .
Exceptions
T:System.ArgumentOutOfRangeExceptiondecimals is less than 0 or greater than 28.
T:System.OverflowExceptionThe result is outside the range of a T:System.Decimal.

Definition at line 272 of file Math.cs.

◆ Round() [7/8]

static decimal System.Math.Round ( decimal  d,
MidpointRounding  mode 
)
static

Rounds a decimal value to the nearest integer. A parameter specifies how to round the value if it is midway between two numbers.

Parameters
dA decimal number to be rounded.
modeSpecification for how to round d if it is midway between two other numbers.
Returns
The integer nearest d . If d is halfway between two numbers, one of which is even and the other odd, then mode determines which of the two is returned.
Exceptions
T:System.ArgumentExceptionmode is not a valid value of T:System.MidpointRounding.
T:System.OverflowExceptionThe result is outside the range of a T:System.Decimal.

Definition at line 285 of file Math.cs.

◆ Round() [8/8]

static decimal System.Math.Round ( decimal  d,
int  decimals,
MidpointRounding  mode 
)
static

Rounds a decimal value to a specified number of fractional digits. A parameter specifies how to round the value if it is midway between two numbers.

Parameters
dA decimal number to be rounded.
decimalsThe number of decimal places in the return value.
modeSpecification for how to round d if it is midway between two other numbers.
Returns
The number nearest to d that contains a number of fractional digits equal to decimals . If d has fewer fractional digits than decimals , d is returned unchanged.
Exceptions
T:System.ArgumentOutOfRangeExceptiondecimals is less than 0 or greater than 28.
T:System.ArgumentExceptionmode is not a valid value of T:System.MidpointRounding.
T:System.OverflowExceptionThe result is outside the range of a T:System.Decimal.

Definition at line 301 of file Math.cs.

◆ Sign() [1/7]

static int System.Math.Sign ( sbyte  value)
static

Returns an integer that indicates the sign of an 8-bit signed integer.

Parameters
valueA signed number.
Returns
A number that indicates the sign of value , as shown in the following table.Return value Meaning -1 value is less than zero. 0 value is equal to zero. 1 value is greater than zero.

Definition at line 998 of file Math.cs.

◆ Sign() [2/7]

static int System.Math.Sign ( short  value)
static

Returns an integer that indicates the sign of a 16-bit signed integer.

Parameters
valueA signed number.
Returns
A number that indicates the sign of value , as shown in the following table.Return value Meaning -1 value is less than zero. 0 value is equal to zero. 1 value is greater than zero.

Definition at line 1018 of file Math.cs.

◆ Sign() [3/7]

static int System.Math.Sign ( int  value)
static

Returns an integer that indicates the sign of a 32-bit signed integer.

Parameters
valueA signed number.
Returns
A number that indicates the sign of value , as shown in the following table.Return value Meaning -1 value is less than zero. 0 value is equal to zero. 1 value is greater than zero.

Definition at line 1038 of file Math.cs.

◆ Sign() [4/7]

static int System.Math.Sign ( long  value)
static

Returns an integer that indicates the sign of a 64-bit signed integer.

Parameters
valueA signed number.
Returns
A number that indicates the sign of value , as shown in the following table.Return value Meaning -1 value is less than zero. 0 value is equal to zero. 1 value is greater than zero.

Definition at line 1058 of file Math.cs.

◆ Sign() [5/7]

static int System.Math.Sign ( float  value)
static

Returns an integer that indicates the sign of a single-precision floating-point number.

Parameters
valueA signed number.
Returns
A number that indicates the sign of value , as shown in the following table.Return value Meaning -1 value is less than zero. 0 value is equal to zero. 1 value is greater than zero.
Exceptions
T:System.ArithmeticExceptionvalue is equal to F:System.Single.NaN.

Definition at line 1080 of file Math.cs.

◆ Sign() [6/7]

static int System.Math.Sign ( double  value)
static

Returns an integer that indicates the sign of a double-precision floating-point number.

Parameters
valueA signed number.
Returns
A number that indicates the sign of value , as shown in the following table.Return value Meaning -1 value is less than zero. 0 value is equal to zero. 1 value is greater than zero.
Exceptions
T:System.ArithmeticExceptionvalue is equal to F:System.Double.NaN.

Definition at line 1106 of file Math.cs.

◆ Sign() [7/7]

static int System.Math.Sign ( decimal  value)
static

Returns an integer that indicates the sign of a decimal number.

Parameters
valueA signed decimal number.
Returns
A number that indicates the sign of value , as shown in the following table.Return value Meaning -1 value is less than zero. 0 value is equal to zero. 1 value is greater than zero.

Definition at line 1130 of file Math.cs.

◆ Sin()

static double System.Math.Sin ( double  a)

Returns the sine of the specified angle.

Parameters
aAn angle, measured in radians.
Returns
The sine of a . If a is equal to F:System.Double.NaN, F:System.Double.NegativeInfinity, or F:System.Double.PositiveInfinity, this method returns F:System.Double.NaN.

◆ Sinh()

static double System.Math.Sinh ( double  value)

Returns the hyperbolic sine of the specified angle.

Parameters
valueAn angle, measured in radians.
Returns
The hyperbolic sine of value . If value is equal to F:System.Double.NegativeInfinity, F:System.Double.PositiveInfinity, or F:System.Double.NaN, this method returns a T:System.Double equal to value .

◆ Sqrt()

static double System.Math.Sqrt ( double  d)

Returns the square root of a specified number.

Parameters
dThe number whose square root is to be found.
Returns
One of the values in the following table. d parameter Return value Zero or positive The positive square root of d . Negative F:System.Double.NaN Equals F:System.Double.NaN F:System.Double.NaN Equals F:System.Double.PositiveInfinity F:System.Double.PositiveInfinity

◆ Tan()

static double System.Math.Tan ( double  a)

Returns the tangent of the specified angle.

Parameters
aAn angle, measured in radians.
Returns
The tangent of a . If a is equal to F:System.Double.NaN, F:System.Double.NegativeInfinity, or F:System.Double.PositiveInfinity, this method returns F:System.Double.NaN.

◆ Tanh()

static double System.Math.Tanh ( double  value)

Returns the hyperbolic tangent of the specified angle.

Parameters
valueAn angle, measured in radians.
Returns
The hyperbolic tangent of value . If value is equal to F:System.Double.NegativeInfinity, this method returns -1. If value is equal to F:System.Double.PositiveInfinity, this method returns 1. If value is equal to F:System.Double.NaN, this method returns F:System.Double.NaN.

◆ Truncate() [1/2]

static decimal System.Math.Truncate ( decimal  d)
static

Calculates the integral part of a specified decimal number.

Parameters
dA number to truncate.
Returns
The integral part of d ; that is, the number that remains after any fractional digits have been discarded.

Definition at line 314 of file Math.cs.

◆ Truncate() [2/2]

static double System.Math.Truncate ( double  d)
static

Calculates the integral part of a specified double-precision floating-point number.

Parameters
dA number to truncate.
Returns

The integral part of d ; that is, the number that remains after any fractional digits have been discarded, or one of the values listed in the following table. d Return value F:System.Double.NaN

F:System.Double.NaN

F:System.Double.NegativeInfinity

F:System.Double.NegativeInfinity

F:System.Double.PositiveInfinity

F:System.Double.PositiveInfinity

Definition at line 337 of file Math.cs.

Member Data Documentation

◆ E

const double System.Math.E = 2.7182818284590451

Represents the natural logarithmic base, specified by the constant, e.

Definition at line 42 of file Math.cs.

◆ PI

const double System.Math.PI = 3.1415926535897931

Represents the ratio of the circumference of a circle to its diameter, specified by the constant, π.

Definition at line 38 of file Math.cs.


The documentation for this class was generated from the following file: