Friday, December 30, 2011

System.Math Class in C#

Namespace: System

Assembly: mscorlib (mscorlib.dll)

Here is a recap from Math Class in MSDN and is depend on .NET Framework version 4.5. You can switch to the other versions once you navigate to the MSND website.

Methods:

Name

Description

Abs(arg1)

Returns the absolute value of a number*. (*Support Decimal, Double, Int16, Int32, Int64, SByte, or Single number for input and return respectively)

Acos

Returns the angle whose cosine is the specified number.

Asin

Returns the angle whose sine is the specified number.

Atan

Returns the angle whose tangent is the specified number.

Atan2

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

BigMul

Produces the full product of two 32-bit numbers.

Ceiling(arg1)

Returns the smallest integral value that is greater than or equal to the specified number*. (*Support Decimal or Double for input and return respectively)

Cos

Returns the cosine of the specified angle.

Cosh

Returns the hyperbolic cosine of the specified angle.

DivRem(arg1, arg2, out arg3)

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

Exp

Returns e raised to the specified power.

Floor

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

IEEERemainder

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

Log(Double)

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

Log(Double, Double)

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

Log10

Returns the base 10 logarithm of a specified number.

Max(arg1, arg2)

Returns the larger of two 8-bit unsigned integers (Byte), decimals, 16-bit signed integers (Int16), 32-bit signed integers (Int32), 64-bit signed integers (Int64), 8-bit signed integers (SByte), single-precision floating-point numbers (Single), decimal numbers (Decimal), double-precision floating-point numbers (Double), 16-bit unsigned integers (UInt16), 32-bit unsigned integers (UInt32), or 64-bit unsigned integers (UInt64).

Min(arg1, arg2)

Returns the smaller of two 8-bit unsigned integers (Byte), decimals, 16-bit signed integers (Int16), 32-bit signed integers (Int32), 64-bit signed integers (Int64), 8-bit signed integers (SByte), single-precision floating-point numbers (Single), decimal numbers (Decimal), double-precision floating-point numbers (Double), 16-bit unsigned integers (UInt16), 32-bit unsigned integers (UInt32), or 64-bit unsigned integers (UInt64).

Pow

Returns a specified number raised to the specified power.

Round(arg1)

Rounds a decimal value (Decimal) or double-precision floating-point value (Double) to the nearest integral value.

Round(arg1, Int32)

Rounds a decimal value (Decimal) or double-precision floating-point value (Double) to a specified number of fractional digits.

Round(arg1, MidpointRounding)

Rounds a decimal value (Decimal) or double-precision floating-point value (Double) to the nearest integer. A parameter specifies how to round the value if it is midway between two other numbers.

Round(arg1, Int32, MidpointRounding)

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

Sign(arg1)

Returns a integer value (1, 0, –1) indicating the sign of a decimal number (Decimal), 16-bit signed integer (Int16), 32-bit signed integer (Int32), 64-bit signed integer (Int64), 8-bit signed integer (SByte), a single-precision floating-point (Single), or double-precision floating-point (Double).

Sin

Returns the sine of the specified angle.

Sinh

Returns the hyperbolic sine of the specified angle.

Sqrt

Returns the square root of a specified number.

Tan

Returns the tangent of the specified angle.

Tanh

Returns the hyperbolic tangent of the specified angle.

Truncate(arg1)

Calculates the integral part of a specified decimal number (Decimal) or double-precision floating-point number (Double).

Fileds:

Name

Description

E

Represents the natural logarithmic base, specified by the constant, e. The value of this field is 2.7182818284590452354.

PI

Represents the ratio of the circumference of a circle to its diameter, specified by the constant, π. The value of this field is 3.14159265358979323846.

No comments:

Post a Comment