Number
Represents Generic Math extensions.
public static TResult FromBits<TResult>(this ReadOnlySpan<bool> bits) where TResult : struct, INumber<TResult>, IBitwiseOperators<TResult, TResult, TResult>, IShiftOperators<TResult, int, TResult>
Converts bit vector to a value of type TResult.
public static void GetBits<T>(this T value, Span<bool> bits) where T : ValueType modreq(System.Runtime.InteropServices.UnmanagedType), INumber<T>, IBitwiseOperators<T, T, T>, IShiftOperators<T, int, T>
Converts a value to a set of bits.
Gets maximum number of bytes that can be used by T type
when encoded in little-endian or big-endian format.
public static T GetPrime<T>(T lowerBound, ReadOnlySpan<T> cachedPrimes = default) where T : struct, IBinaryNumber<T>, ISignedNumber<T>, IMinMaxValue<T>, IShiftOperators<T, int, T>
Gets a prime number which is greater than the specified value.
public static bool IsBitSet<T>(this T number, int position) where T : struct, INumber<T>, IBitwiseOperators<T, T, T>, IShiftOperators<T, int, T>
Gets a value indicating that the specified bit is set.
public static bool IsPrime<T>(T value) where T : struct, IBinaryNumber<T>, ISignedNumber<T>, IShiftOperators<T, int, T>
Determines whether the specified value is a prime number.
Determines whether the specified numeric type is signed.
public static TOutput Normalize<TInput, TOutput>(this TInput value, TInput min, TInput max) where TInput : struct, INumberBase<TInput>, IComparisonOperators<TInput, TInput, bool> where TOutput : struct, IFloatingPoint<TOutput>
Normalizes value in the specified range.
Normalizes 64-bit unsigned integer to interval [0..1).
Normalizes 64-bit signed integer to interval [0..1).
Normalizes 32-bit unsigned integer to interval [0..1).
Normalizes 32-bit signed integer to interval [0..1).
public static T SetBit<T>(this T number, int position, bool value) where T : struct, INumber<T>, IBitwiseOperators<T, T, T>, IShiftOperators<T, int, T>
Sets the bit at the specified position.