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
ndoubleThe 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
nlongThe 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
nlongThe number whose factorial to get.
Returns
- BigInteger
The result of the factorial.
Exceptions
- ArgumentException
Thrown when the provided number is negative.
Max(params byte[])
public static byte Max(params byte[] values)
Parameters
valuesbyte[]The values to compare.
Returns
Max(IEnumerable<byte>)
public static byte Max(IEnumerable<byte> values)
Parameters
valuesIEnumerable<byte>The values to compare.
Returns
Max(IEnumerable<short>)
public static short Max(IEnumerable<short> values)
Parameters
valuesIEnumerable<short>The values to compare.
Returns
Max(IEnumerable<int>)
public static int Max(IEnumerable<int> values)
Parameters
valuesIEnumerable<int>The values to compare.
Returns
Max(IEnumerable<long>)
public static long Max(IEnumerable<long> values)
Parameters
valuesIEnumerable<long>The values to compare.
Returns
Max(IEnumerable<sbyte>)
public static sbyte Max(IEnumerable<sbyte> values)
Parameters
valuesIEnumerable<sbyte>The values to compare.
Returns
Max(IEnumerable<ushort>)
public static ushort Max(IEnumerable<ushort> values)
Parameters
valuesIEnumerable<ushort>The values to compare.
Returns
Max(IEnumerable<uint>)
public static uint Max(IEnumerable<uint> values)
Parameters
valuesIEnumerable<uint>The values to compare.
Returns
Max(IEnumerable<ulong>)
public static ulong Max(IEnumerable<ulong> values)
Parameters
valuesIEnumerable<ulong>The values to compare.
Returns
Max(params short[])
public static short Max(params short[] values)
Parameters
valuesshort[]The values to compare.
Returns
Max(params int[])
public static int Max(params int[] values)
Parameters
valuesint[]The values to compare.
Returns
Max(params long[])
public static long Max(params long[] values)
Parameters
valueslong[]The values to compare.
Returns
Max(params sbyte[])
public static sbyte Max(params sbyte[] values)
Parameters
valuessbyte[]The values to compare.
Returns
Max(params ushort[])
public static ushort Max(params ushort[] values)
Parameters
valuesushort[]The values to compare.
Returns
Max(params uint[])
public static uint Max(params uint[] values)
Parameters
valuesuint[]The values to compare.
Returns
Max(params ulong[])
public static ulong Max(params ulong[] values)
Parameters
valuesulong[]The values to compare.
Returns
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
valuesIEnumerable<T>The values to compare.
Returns
- T
The largest value that was found in the collection of values.
Type Parameters
TThe 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
valuesT[]The values to compare.
Returns
- T
The largest value that was found in the collection of values.
Type Parameters
TThe type of the number values to compare.
Min(params byte[])
public static byte Min(params byte[] values)
Parameters
valuesbyte[]The values to compare.
Returns
Min(IEnumerable<byte>)
public static byte Min(IEnumerable<byte> values)
Parameters
valuesIEnumerable<byte>The values to compare.
Returns
Min(IEnumerable<short>)
public static short Min(IEnumerable<short> values)
Parameters
valuesIEnumerable<short>The values to compare.
Returns
Min(IEnumerable<int>)
public static int Min(IEnumerable<int> values)
Parameters
valuesIEnumerable<int>The values to compare.
Returns
Min(IEnumerable<long>)
public static long Min(IEnumerable<long> values)
Parameters
valuesIEnumerable<long>The values to compare.
Returns
Min(IEnumerable<sbyte>)
public static sbyte Min(IEnumerable<sbyte> values)
Parameters
valuesIEnumerable<sbyte>The values to compare.
Returns
Min(IEnumerable<ushort>)
public static ushort Min(IEnumerable<ushort> values)
Parameters
valuesIEnumerable<ushort>The values to compare.
Returns
Min(IEnumerable<uint>)
public static uint Min(IEnumerable<uint> values)
Parameters
valuesIEnumerable<uint>The values to compare.
Returns
Min(IEnumerable<ulong>)
public static ulong Min(IEnumerable<ulong> values)
Parameters
valuesIEnumerable<ulong>The values to compare.
Returns
Min(params short[])
public static short Min(params short[] values)
Parameters
valuesshort[]The values to compare.
Returns
Min(params int[])
public static int Min(params int[] values)
Parameters
valuesint[]The values to compare.
Returns
Min(params long[])
public static long Min(params long[] values)
Parameters
valueslong[]The values to compare.
Returns
Min(params sbyte[])
public static sbyte Min(params sbyte[] values)
Parameters
valuessbyte[]The values to compare.
Returns
Min(params ushort[])
public static ushort Min(params ushort[] values)
Parameters
valuesushort[]The values to compare.
Returns
Min(params uint[])
public static uint Min(params uint[] values)
Parameters
valuesuint[]The values to compare.
Returns
Min(params ulong[])
public static ulong Min(params ulong[] values)
Parameters
valuesulong[]The values to compare.
Returns
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
valuesIEnumerable<T>The values to compare.
Returns
- T
The smallest value that was found in the collection of values.
Type Parameters
TThe 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
valuesT[]The values to compare.
Returns
- T
The smallest value that was found in the collection of values.
Type Parameters
TThe 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
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
Returns
- long
The result of the power.
Exceptions
- InvalidOperationException
Thrown when both the base and the exponent are 0.