MathHelper

StockSharp.Xaml.Charting.Rendering.HighQualityRasterizer.Agg.VectorMath

Contains common mathematical functions and constants.

Methods

BinomialCoefficient
public static long BinomialCoefficient(int n, int k)
result = MathHelper.BinomialCoefficient(n, k)

Calculates the binomial coefficient above .

n
The n.
k
The k.

Returns: n! / (k! * (n - k)!)

DegreesToRadians
public static double DegreesToRadians(double degrees)
result = MathHelper.DegreesToRadians(degrees)

Convert degrees to radians

degrees
An angle in degrees

Returns: The angle expressed in radians

Factorial
public static long Factorial(int n)
result = MathHelper.Factorial(n)

Calculates the factorial of a given natural number.

n
The number.

Returns: n!

InverseSqrtFast
public static double InverseSqrtFast(double x)
result = MathHelper.InverseSqrtFast(x)

Returns an approximation of the inverse square root of left number.

x
A number.

Returns: An approximation of the inverse square root of the specified number, with an upper error bound of 0.001

InverseSqrtFast
public static float InverseSqrtFast(float x)
result = MathHelper.InverseSqrtFast(x)

Returns an approximation of the inverse square root of left number.

x
A number.

Returns: An approximation of the inverse square root of the specified number, with an upper error bound of 0.001

NextPowerOfTwo
public static long NextPowerOfTwo(long n)
result = MathHelper.NextPowerOfTwo(n)

Returns the next power of two that is larger than the specified number.

n
The specified number.

Returns: The next power of two.

NextPowerOfTwo
public static double NextPowerOfTwo(double n)
result = MathHelper.NextPowerOfTwo(n)

Returns the next power of two that is larger than the specified number.

n
The specified number.

Returns: The next power of two.

NextPowerOfTwo
public static float NextPowerOfTwo(float n)
result = MathHelper.NextPowerOfTwo(n)

Returns the next power of two that is larger than the specified number.

n
The specified number.

Returns: The next power of two.

NextPowerOfTwo
public static int NextPowerOfTwo(int n)
result = MathHelper.NextPowerOfTwo(n)

Returns the next power of two that is larger than the specified number.

n
The specified number.

Returns: The next power of two.

RadiansToDegrees
public static double RadiansToDegrees(double radians)
result = MathHelper.RadiansToDegrees(radians)

Convert radians to degrees

radians
An angle in radians

Returns: The angle expressed in degrees

Swap
public static void Swap(double a, double b)
MathHelper.Swap(a, b)

Swaps two double values.

a
The first value.
b
The second value.
Swap
public static void Swap(float a, float b)
MathHelper.Swap(a, b)

Swaps two float values.

a
The first value.
b
The second value.

Fields

E
public const double E
value = MathHelper.E

Defines the value of E as a Single.

Log10E
public const double Log10E
value = MathHelper.Log10E

Defines the base-10 logarithm of E.

Log2E
public const double Log2E
value = MathHelper.Log2E

Defines the base-2 logarithm of E.

Pi
public const double Pi
value = MathHelper.Pi

Defines the value of Pi as a Single.

PiOver2
public const double PiOver2
value = MathHelper.PiOver2

Defines the value of Pi divided by two as a Single.

PiOver3
public const double PiOver3
value = MathHelper.PiOver3

Defines the value of Pi divided by three as a Single.

PiOver4
public const double PiOver4
value = MathHelper.PiOver4

Definesthe value of Pi divided by four as a Single.

PiOver6
public const double PiOver6
value = MathHelper.PiOver6

Defines the value of Pi divided by six as a Single.

ThreePiOver2
public const double ThreePiOver2
value = MathHelper.ThreePiOver2

Defines the value of Pi multiplied by 3 and divided by two as a Single.

TwoPi
public const double TwoPi
value = MathHelper.TwoPi

Defines the value of Pi multiplied by two as a Single.