Table of Contents

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

value T

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

value double

Returns

int

Log(double)

Calculates the base-e log of the value using Log(double).

public static double Log(this double value)

Parameters

value double

Returns

double

Log(double, double)

Calculates the log of the value using Log(double, double).

public static double Log(this double value, double @base)

Parameters

value double
base double

Returns

double

Log10(double)

Calculates the base-10 log of the value using Log10(double).

public static double Log10(this double value)

Parameters

value double

Returns

double

Log2(double)

Calculates the base-2 log of the value using Log2(double).

public static double Log2(this double value)

Parameters

value double

Returns

double

Pow(double, double)

Shorthand for Pow(double, double).

public static double Pow(this double x, double exponent)

Parameters

x double

The base number.

exponent double

The exponent to raise the base to.

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

value double

Returns

double

Sqrt(float)

Calculates the square root of the value using Sqrt(float).

public static float Sqrt(this float value)

Parameters

value float

Returns

float

Square(decimal)

Returns the square of the given number.

public static decimal Square(this decimal x)

Parameters

x decimal

The 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

x double

The 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

x int

The 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

x long

The 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

x float

The 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

x uint

The 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

x ulong

The 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

x T

The number to square.

Returns

INumber<T>

The square of the number, equal to x * x.

Type Parameters

T

The type of the number to square.