Class DecimalMath
Provides transcendental math functions for decimal type. .NET does not provide these natively since decimal is designed for financial calculations.
public static class DecimalMath
- Inheritance
-
DecimalMath
- Inherited Members
Fields
E
Euler's number e.
public const decimal E = 2.7182818284590452353602874714
Field Value
Ln10
Natural logarithm of 10.
public const decimal Ln10 = 2.3025850929940456840179914547
Field Value
Ln2
Natural logarithm of 2.
public const decimal Ln2 = 0.6931471805599453094172321215
Field Value
Pi
The pi constant. Pi radians = 180 degrees.
public const decimal Pi = 3.1415926535897932384626433833
Field Value
PiHalf
Pi / 2 = 90 degrees.
public const decimal PiHalf = 1.5707963267948966192313216916
Field Value
PiQuarter
Pi / 4 = 45 degrees.
public const decimal PiQuarter = 0.7853981633974483096156608458
Field Value
TwoPi
2 * Pi = 360 degrees.
public const decimal TwoPi = 6.2831853071795864769252867666
Field Value
Methods
ATan(decimal)
Returns the angle whose tangent is the specified number.
public static decimal ATan(decimal x)
Parameters
xdecimal
Returns
ATan2(decimal, decimal)
Returns the angle whose tangent is the quotient of two numbers.
public static decimal ATan2(decimal y, decimal x)
Parameters
Returns
- decimal
Angle in radians, -pi to pi.
Exp(decimal)
Returns e raised to the specified power.
public static decimal Exp(decimal d)
Parameters
ddecimal
Returns
Log(decimal)
Returns the natural (base e) logarithm of a number.
public static decimal Log(decimal d)
Parameters
ddecimal
Returns
Log10(decimal)
Returns the base 10 logarithm of a number.
public static decimal Log10(decimal d)
Parameters
ddecimal
Returns
Pow(decimal, decimal)
Returns x raised to the power y.
public static decimal Pow(decimal x, decimal y)
Parameters
Returns
Remainder(decimal, decimal)
Computes remainder with maximum precision retained.
public static decimal Remainder(decimal d1, decimal d2)
Parameters
Returns
Sqrt(decimal)
Returns the square root of a decimal using the Babylonian method.
public static decimal Sqrt(decimal s)
Parameters
sdecimalA non-negative number.