System.Math

Namespace: System

Provides constants and static methods for trigonometric, logarithmic, antilogarithmic, exponential, and other common mathematical functions.

Public Static Fields

Name Description
PI Represents the ratio of the circumference of a circle to its diameter, specified as π.
E Represents the natural logarithmic base, e.

Public Static Methods

Absolute Value

Abs(double a)

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

double a
Returns: The absolute value of a.

Abs(int a)

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

int a
Returns: The absolute value of a.

Abs(long a)

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

long a
Returns: The absolute value of a.

Rounding

Ceiling(double a)

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

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

Floor(double a)

Returns the largest integral value that is less than or equal to the specified floating-point number.

double a
Returns: A double-precision floating-point number that is equal to the largest integral value that is less than or equal to a.

Round(double a)

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

double a
Returns: The nearest integral value to a.

Trigonometric Functions

Sin(double a)

Returns the sine of the specified angle, measured in radians.

double a
Returns: The sine of a.

Cos(double a)

Returns the cosine of the specified angle, measured in radians.

double a
Returns: The cosine of a.

Tan(double a)

Returns the tangent of the specified angle, measured in radians.

double a
Returns: The tangent of a.

Logarithmic and Exponential Functions

Log(double a)

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

double a
Returns: The natural logarithm of a.

Log10(double a)

Returns the base 10 logarithm of a specified number.

double a
Returns: The base 10 logarithm of a.

Exp(double a)

Returns e raised to the power of a specified number.

double a
Returns: e raised to the power of a.

Power Functions

Pow(double x, double y)

Returns the specified number raised to the specified power.

double x
double y
Returns: The value of x raised to the power of y.

Other Useful Methods

Sqrt(double a)

Returns the square root of a specified number.

double a
Returns: The square root of a.

Max(double val1, double val2)

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

double val1
double val2
Returns: The larger of val1 and val2.

Min(double val1, double val2)

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

double val1
double val2
Returns: The smaller of val1 and val2.