Class MathNumberExtensions
- Namespace
- Garyon.Mathematics
- Assembly
- Garyon.dll
Provides math-related extensions on number types.
public static class MathNumberExtensions
- Inheritance
-
MathNumberExtensions
- Inherited Members
Methods
Halve<T>(T)
Divides the specified integer value by two, rounding towards zero, using the defined shift operators.
public static T Halve<T>(this T value) where T : IBinaryInteger<T>, IShiftOperators<T, int, T>
Parameters
valueT
Returns
- T
Type Parameters
T
ILogB(double)
Calculates the base-2 integer log of the value using ILogB(double).
public static int ILogB(this double value)
Parameters
valuedouble
Returns
Log(double)
Calculates the base-e log of the value using Log(double).
public static double Log(this double value)
Parameters
valuedouble
Returns
Log(double, double)
Calculates the log of the value using Log(double, double).
public static double Log(this double value, double @base)
Parameters
Returns
Log10(double)
Calculates the base-10 log of the value using Log10(double).
public static double Log10(this double value)
Parameters
valuedouble
Returns
Log2(double)
Calculates the base-2 log of the value using Log2(double).
public static double Log2(this double value)
Parameters
valuedouble
Returns
Pow(double, double)
Shorthand for Pow(double, double).
public static double Pow(this double x, double exponent)
Parameters
Returns
- double
The result of the power operation.
Sqrt(double)
Calculates the square root of the value using Sqrt(double).
public static double Sqrt(this double value)
Parameters
valuedouble
Returns
Sqrt(float)
Calculates the square root of the value using Sqrt(float).
public static float Sqrt(this float value)
Parameters
valuefloat
Returns
Square(decimal)
Returns the square of the given number.
public static decimal Square(this decimal x)
Parameters
xdecimalThe number to square.
Returns
- decimal
The square of the number, equal to x * x.
Square(double)
Returns the square of the given number.
public static double Square(this double x)
Parameters
xdoubleThe number to square.
Returns
- double
The square of the number, equal to x * x.
Square(int)
Returns the square of the given number.
public static int Square(this int x)
Parameters
xintThe number to square.
Returns
- int
The square of the number, equal to x * x.
Square(long)
Returns the square of the given number.
public static long Square(this long x)
Parameters
xlongThe number to square.
Returns
- long
The square of the number, equal to x * x.
Square(float)
Returns the square of the given number.
public static float Square(this float x)
Parameters
xfloatThe number to square.
Returns
- float
The square of the number, equal to x * x.
Square(uint)
Returns the square of the given number.
public static uint Square(this uint x)
Parameters
xuintThe number to square.
Returns
- uint
The square of the number, equal to x * x.
Square(ulong)
Returns the square of the given number.
public static ulong Square(this ulong x)
Parameters
xulongThe number to square.
Returns
- ulong
The square of the number, equal to x * x.
Square<T>(T)
Returns the square of the given number.
public static INumber<T> Square<T>(this T x) where T : INumber<T>, IMultiplyOperators<T, T, T>
Parameters
xTThe number to square.
Returns
- INumber<T>
The square of the number, equal to x * x.
Type Parameters
TThe type of the number to square.