Table of Contents

Class GeneralMath

Namespace
Garyon.Mathematics
Assembly
Garyon.dll

Provides general mathematical functions that are not provided in the Math class.

public static class GeneralMath
Inheritance
GeneralMath
Inherited Members

Methods

Factorial(double)

Calculates the factorial of a number.

public static double Factorial(double n)

Parameters

n double

The number whose factorial to get. If it is not a round number, it will be rounded according to the Round(double) function.

Returns

double

The result of the factorial.

Exceptions

ArgumentException

Thrown when the provided number is negative.

Factorial(long)

Calculates the factorial of a number.

public static long Factorial(long n)

Parameters

n long

The number whose factorial to get.

Returns

long

The result of the factorial.

Exceptions

ArgumentException

Thrown when the provided number is negative.

FactorialBigInteger(long)

Calculates the factorial of a number.

public static BigInteger FactorialBigInteger(long n)

Parameters

n long

The number whose factorial to get.

Returns

BigInteger

The result of the factorial.

Exceptions

ArgumentException

Thrown when the provided number is negative.

Max(params byte[])

Returns the largest byte from a byte[].

public static byte Max(params byte[] values)

Parameters

values byte[]

The values to compare.

Returns

byte

The largest byte that was found in the byte[].

Max(IEnumerable<byte>)

Returns the largest byte from a collection of bytes.

public static byte Max(IEnumerable<byte> values)

Parameters

values IEnumerable<byte>

The values to compare.

Returns

byte

The largest byte that was found in the collection of bytes.

Max(IEnumerable<short>)

Returns the largest short from a collection of shorts.

public static short Max(IEnumerable<short> values)

Parameters

values IEnumerable<short>

The values to compare.

Returns

short

The largest short that was found in the collection of shorts.

Max(IEnumerable<int>)

Returns the largest int from a collection of ints.

public static int Max(IEnumerable<int> values)

Parameters

values IEnumerable<int>

The values to compare.

Returns

int

The largest int that was found in the collection of ints.

Max(IEnumerable<long>)

Returns the largest long from a collection of longs.

public static long Max(IEnumerable<long> values)

Parameters

values IEnumerable<long>

The values to compare.

Returns

long

The largest long that was found in the collection of longs.

Max(IEnumerable<sbyte>)

Returns the largest sbyte from a collection of sbytes.

public static sbyte Max(IEnumerable<sbyte> values)

Parameters

values IEnumerable<sbyte>

The values to compare.

Returns

sbyte

The largest sbyte that was found in the collection of sbytes.

Max(IEnumerable<ushort>)

Returns the largest ushort from a collection of ushorts.

public static ushort Max(IEnumerable<ushort> values)

Parameters

values IEnumerable<ushort>

The values to compare.

Returns

ushort

The largest ushort that was found in the collection of ushorts.

Max(IEnumerable<uint>)

Returns the largest uint from a collection of uints.

public static uint Max(IEnumerable<uint> values)

Parameters

values IEnumerable<uint>

The values to compare.

Returns

uint

The largest uint that was found in the collection of uints.

Max(IEnumerable<ulong>)

Returns the largest ulong from a collection of ulongs.

public static ulong Max(IEnumerable<ulong> values)

Parameters

values IEnumerable<ulong>

The values to compare.

Returns

ulong

The largest ulong that was found in the collection of ulongs.

Max(params short[])

Returns the largest short from a short[].

public static short Max(params short[] values)

Parameters

values short[]

The values to compare.

Returns

short

The largest short that was found in the short[].

Max(params int[])

Returns the largest int from a int[].

public static int Max(params int[] values)

Parameters

values int[]

The values to compare.

Returns

int

The largest int that was found in the int[].

Max(params long[])

Returns the largest long from a long[].

public static long Max(params long[] values)

Parameters

values long[]

The values to compare.

Returns

long

The largest long that was found in the long[].

Max(params sbyte[])

Returns the largest sbyte from a sbyte[].

public static sbyte Max(params sbyte[] values)

Parameters

values sbyte[]

The values to compare.

Returns

sbyte

The largest sbyte that was found in the sbyte[].

Max(params ushort[])

Returns the largest ushort from a ushort[].

public static ushort Max(params ushort[] values)

Parameters

values ushort[]

The values to compare.

Returns

ushort

The largest ushort that was found in the ushort[].

Max(params uint[])

Returns the largest uint from a uint[].

public static uint Max(params uint[] values)

Parameters

values uint[]

The values to compare.

Returns

uint

The largest uint that was found in the uint[].

Max(params ulong[])

Returns the largest ulong from a ulong[].

public static ulong Max(params ulong[] values)

Parameters

values ulong[]

The values to compare.

Returns

ulong

The largest ulong that was found in the ulong[].

Max<T>(IEnumerable<T>)

Returns the largest value from a collection of values.

public static T Max<T>(IEnumerable<T> values) where T : INumber<T>, IMinMaxValue<T>

Parameters

values IEnumerable<T>

The values to compare.

Returns

T

The largest value that was found in the collection of values.

Type Parameters

T

The type of the number values to compare.

Max<T>(params T[])

Returns the largest value from a collection of values.

public static T Max<T>(params T[] values) where T : INumber<T>, IMinMaxValue<T>

Parameters

values T[]

The values to compare.

Returns

T

The largest value that was found in the collection of values.

Type Parameters

T

The type of the number values to compare.

Min(params byte[])

Returns the smallest byte from a byte[].

public static byte Min(params byte[] values)

Parameters

values byte[]

The values to compare.

Returns

byte

The smallest byte that was found in the byte[].

Min(IEnumerable<byte>)

Returns the smallest byte from a collection of bytes.

public static byte Min(IEnumerable<byte> values)

Parameters

values IEnumerable<byte>

The values to compare.

Returns

byte

The smallest byte that was found in the collection of bytes.

Min(IEnumerable<short>)

Returns the smallest short from a collection of shorts.

public static short Min(IEnumerable<short> values)

Parameters

values IEnumerable<short>

The values to compare.

Returns

short

The smallest short that was found in the collection of shorts.

Min(IEnumerable<int>)

Returns the smallest int from a collection of ints.

public static int Min(IEnumerable<int> values)

Parameters

values IEnumerable<int>

The values to compare.

Returns

int

The smallest int that was found in the collection of ints.

Min(IEnumerable<long>)

Returns the smallest long from a collection of longs.

public static long Min(IEnumerable<long> values)

Parameters

values IEnumerable<long>

The values to compare.

Returns

long

The smallest long that was found in the collection of longs.

Min(IEnumerable<sbyte>)

Returns the smallest sbyte from a collection of sbytes.

public static sbyte Min(IEnumerable<sbyte> values)

Parameters

values IEnumerable<sbyte>

The values to compare.

Returns

sbyte

The smallest sbyte that was found in the collection of sbytes.

Min(IEnumerable<ushort>)

Returns the smallest ushort from a collection of ushorts.

public static ushort Min(IEnumerable<ushort> values)

Parameters

values IEnumerable<ushort>

The values to compare.

Returns

ushort

The smallest ushort that was found in the collection of ushorts.

Min(IEnumerable<uint>)

Returns the smallest uint from a collection of uints.

public static uint Min(IEnumerable<uint> values)

Parameters

values IEnumerable<uint>

The values to compare.

Returns

uint

The smallest uint that was found in the collection of uints.

Min(IEnumerable<ulong>)

Returns the smallest ulong from a collection of ulongs.

public static ulong Min(IEnumerable<ulong> values)

Parameters

values IEnumerable<ulong>

The values to compare.

Returns

ulong

The smallest ulong that was found in the collection of ulongs.

Min(params short[])

Returns the smallest short from a short[].

public static short Min(params short[] values)

Parameters

values short[]

The values to compare.

Returns

short

The smallest short that was found in the short[].

Min(params int[])

Returns the smallest int from a int[].

public static int Min(params int[] values)

Parameters

values int[]

The values to compare.

Returns

int

The smallest int that was found in the int[].

Min(params long[])

Returns the smallest long from a long[].

public static long Min(params long[] values)

Parameters

values long[]

The values to compare.

Returns

long

The smallest long that was found in the long[].

Min(params sbyte[])

Returns the smallest sbyte from a sbyte[].

public static sbyte Min(params sbyte[] values)

Parameters

values sbyte[]

The values to compare.

Returns

sbyte

The smallest sbyte that was found in the sbyte[].

Min(params ushort[])

Returns the smallest ushort from a ushort[].

public static ushort Min(params ushort[] values)

Parameters

values ushort[]

The values to compare.

Returns

ushort

The smallest ushort that was found in the ushort[].

Min(params uint[])

Returns the smallest uint from a uint[].

public static uint Min(params uint[] values)

Parameters

values uint[]

The values to compare.

Returns

uint

The smallest uint that was found in the uint[].

Min(params ulong[])

Returns the smallest ulong from a ulong[].

public static ulong Min(params ulong[] values)

Parameters

values ulong[]

The values to compare.

Returns

ulong

The smallest ulong that was found in the ulong[].

Min<T>(IEnumerable<T>)

Returns the smallest value from a collection of values.

public static T Min<T>(IEnumerable<T> values) where T : INumber<T>, IMinMaxValue<T>

Parameters

values IEnumerable<T>

The values to compare.

Returns

T

The smallest value that was found in the collection of values.

Type Parameters

T

The type of the number values to compare.

Min<T>(params T[])

Returns the smallest value from a collection of values.

public static T Min<T>(params T[] values) where T : INumber<T>, IMinMaxValue<T>

Parameters

values T[]

The values to compare.

Returns

T

The smallest value that was found in the collection of values.

Type Parameters

T

The type of the number values to compare.

Power(int, int)

Calculates the power of a number raised to another number.

public static int Power(int @base, int exponent)

Parameters

base int

The base.

exponent int

The exponent.

Returns

int

The result of the power.

Exceptions

InvalidOperationException

Thrown when both the base and the exponent are 0.

Power(long, long)

Calculates the power of a number raised to another number.

public static long Power(long @base, long exponent)

Parameters

base long

The base.

exponent long

The exponent.

Returns

long

The result of the power.

Exceptions

InvalidOperationException

Thrown when both the base and the exponent are 0.