← Interactive API Explorer
Namespace: System

Math

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

Methods (17)

double Sqrt(Double)
Returns the square root of a specified number.
ParameterDescription
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 NaN Equals NaNNaN Equals PositiveInfinityPositiveInfinity
double Atan(Double)
Returns the angle whose tangent is the specified number.
ParameterDescription
dA number representing a tangent.
Returns: An angle, θ, measured in radians, such that -π/2 ≤θ≤π/2. -or- NaN if d equals NaN, -π/2 rounded to double precision (-1.5707963267949) if d equals NegativeInfinity, or π/2 rounded to double precision (1.5707963267949) if d equals PositiveInfinity.
double Atan2(Double,Double)
Returns the angle whose tangent is the quotient of two specified numbers.
ParameterDescription
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 NaN, or if x and y are either PositiveInfinity or NegativeInfinity, the method returns NaN.
double Asin(Double)
Returns the angle whose sine is the specified number.
ParameterDescription
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- NaN if d < -1 or d > 1 or d equals NaN.
double Acos(Double)
Returns the angle whose cosine is the specified number.
ParameterDescription
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- NaN if d < -1 or d > 1 or d equals NaN.
double Sin(Double)
Returns the sine of the specified angle.
ParameterDescription
aAn angle, measured in radians.
Returns: The sine of a. If a is equal to NaN, NegativeInfinity, or PositiveInfinity, this method returns NaN.
double Cos(Double)
Returns the cosine of the specified angle.
ParameterDescription
dAn angle, measured in radians.
Returns: The cosine of d. If d is equal to NaN, NegativeInfinity, or PositiveInfinity, this method returns NaN.
double Tan(Double)
Returns the tangent of the specified angle.
ParameterDescription
aAn angle, measured in radians.
Returns: The tangent of a. If a is equal to NaN, NegativeInfinity, or PositiveInfinity, this method returns NaN.
double Exp(Double)
Returns e raised to the specified power.
ParameterDescription
dA number specifying a power.
Returns: The number e raised to the power d. If d equals NaN or PositiveInfinity, that value is returned. If d equals NegativeInfinity, 0 is returned.
double Log(Double)
Returns the natural (base e) logarithm of a specified number.
ParameterDescription
dThe number whose logarithm is to be found.
Returns: One of the values in the following table. d parameter Return value Positive The natural logarithm of d; that is, ln d, or log e d Zero NegativeInfinity Negative NaN Equal to NaNNaN Equal to PositiveInfinityPositiveInfinity
double Log(Double,Double)
Returns the logarithm of a specified number in a specified base.
ParameterDescription
aThe number whose logarithm is to be found.
newBaseThe base of the logarithm.
Returns: One of the values in the following table. (+Infinity denotes PositiveInfinity, -Infinity denotes NegativeInfinity, and NaN denotes NaN.) anewBase Return value a> 0 (0 <newBase< 1) -or-(newBase> 1) lognewBase(a) a< 0 (any value) NaN (any value) newBase< 0 NaN a != 1 newBase = 0 NaN a != 1 newBase = +Infinity NaN a = NaN (any value) NaN (any value) newBase = NaN NaN (any value) newBase = 1 NaN a = 0 0 <newBase< 1 +Infinity a = 0 newBase> 1 -Infinity a = +Infinity 0 <newBase< 1 -Infinity a = +Infinity newBase> 1 +Infinity a = 1 newBase = 0 0 a = 1 newBase = +Infinity 0
double Log10(Double)
Returns the base 10 logarithm of a specified number.
ParameterDescription
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 NegativeInfinity Negative NaN Equal to NaNNaN Equal to PositiveInfinityPositiveInfinity
double Pow(Double,Double)
Returns a specified number raised to the specified power.
ParameterDescription
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.
double Round(Double)
Rounds a double-precision floating-point value to the nearest integral value, and rounds midpoint values to the nearest even number.
ParameterDescription
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 Double instead of an integral type.
Decimal Ceiling(Double)
Returns the smallest integral value that is greater than or equal to the specified double-precision floating-point number.
ParameterDescription
aA double-precision floating-point number.
Returns: The smallest integral value that is greater than or equal to a. If a is equal to NaN, NegativeInfinity, or PositiveInfinity, that value is returned. Note that this method returns a Double instead of an integral type.
Decimal Floor(Double)
Returns the largest integral value less than or equal to the specified double-precision floating-point number.
ParameterDescription
dA double-precision floating-point number.
Returns: The largest integral value less than or equal to d. If d is equal to NaN, NegativeInfinity, or PositiveInfinity, that value is returned.
Decimal Truncate(Double)
Calculates the integral part of a specified double-precision floating-point number.
ParameterDescription
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 NaNNaNNegativeInfinityNegativeInfinityPositiveInfinityPositiveInfinity

Fields & Constants (2)

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