Provides additional math functions that are not available in System.Math.
|
static int | Sign< T > (T num) |
| Returns the sign of a number (-1 for negative, 1 for positive, 0 for zero). More...
|
|
static int | Sign (int num) |
| Returns the sign of a number (-1 for negative, 1 for positive, 0 for zero). More...
|
|
static int | Sign (long num) |
| Returns the sign of a number (-1 for negative, 1 for positive, 0 for zero). More...
|
|
static int | Sign (float num) |
| Returns the sign of a number (-1 for negative, 1 for positive, 0 for zero). More...
|
|
static int | Sign (double num) |
| Returns the sign of a number (-1 for negative, 1 for positive, 0 for zero). More...
|
|
static int | MulShift (int a, int mulBy, int shiftBy) |
| Multiplies two integers, internally producing a double-size result so that overflow is not possible, then divides the result by the specified power of two using a right shift. More...
|
|
static uint | MulShift (uint a, uint mulBy, int shiftBy) |
|
static long | MulShift (long a, long mulBy, int shiftBy) |
|
static ulong | MulShift (ulong a, ulong mulBy, int shiftBy) |
|
static int | MulDiv (int a, int mulBy, int divBy, out int remainder) |
| Multiplies two integers, internally producing a double-size result so that overflow is not possible, then divides the result by the specified number. More...
|
|
static uint | MulDiv (uint a, uint mulBy, uint divBy, out uint remainder) |
|
static long | MulDiv (long a, long mulBy, long divBy, out long remainder) |
|
static ulong | MulDiv (ulong a, ulong mulBy, ulong divBy, out ulong remainder) |
|
static int | MulDiv (int a, int mulBy, int divBy) |
|
static uint | MulDiv (uint a, uint mulBy, uint divBy) |
|
static long | MulDiv (long a, long mulBy, long divBy) |
|
static ulong | MulDiv (ulong a, ulong mulBy, ulong divBy) |
|
static double | Mod (double x, double y) |
|
static float | Mod (float x, float y) |
|
static int | Mod (int x, int y) |
|
static long | Mod (long x, long y) |
|
static uint | RoL (uint value, int amt) |
| Rotates a bit pattern left by the specified number of bits. More...
|
|
static int | RoL (int value, int amt) |
| Rotates a bit pattern left by the specified number of bits. More...
|
|
static ulong | RoL (ulong value, int amt) |
| Rotates a bit pattern left by the specified number of bits. More...
|
|
static long | RoL (long value, int amt) |
| Rotates a bit pattern left by the specified number of bits. More...
|
|
static ushort | RoL (ushort value, int amt) |
| Rotates a bit pattern left by the specified number of bits. More...
|
|
static byte | RoL (byte value, int amt) |
| Rotates a bit pattern left by the specified number of bits. More...
|
|
static uint | RoR (uint value, int amt) |
| Rotates a bit pattern right by the specified number of bits. More...
|
|
static int | RoR (int value, int amt) |
| Rotates a bit pattern right by the specified number of bits. More...
|
|
static ulong | RoR (ulong value, int amt) |
| Rotates a bit pattern right by the specified number of bits. More...
|
|
static long | RoR (long value, int amt) |
| Rotates a bit pattern right by the specified number of bits. More...
|
|
static ushort | RoR (ushort value, int amt) |
| Rotates a bit pattern right by the specified number of bits. More...
|
|
static byte | RoR (byte value, int amt) |
| Rotates a bit pattern right by the specified number of bits. More...
|
|
static uint | Sqrt (long value) |
|
static uint | Sqrt (ulong value) |
|
static int | Sqrt (int value) |
|
static uint | Sqrt (uint value) |
|
static float | Sqrt (float value) |
|
static double | Sqrt (double value) |
|
static int | CountOnes (uint x) |
| Returns the number of '1' bits in x More...
|
|
static byte | CountOnes (byte x) |
|
static int | CountOnes (ushort x) |
|
static int | CountOnes (int x) |
|
static int | CountOnes (long x) |
|
static int | CountOnes (ulong x) |
|
static int | Log2Floor (uint x) |
|
static int | Log2Floor (int x) |
| Returns the floor of the base-2 logarithm of x. e.g. 1024 -> 10, 1000 -> 9 More...
|
|
static int | Log2Floor (ulong x) |
|
static int | Log2Floor (long x) |
|
static uint | NextPowerOf2 (uint x) |
| Gets the next higher power of 2, e.g. 4=>8, 13=>16. More...
|
|
static ulong | NextPowerOf2 (ulong x) |
| Gets the next higher power of 2, e.g. 4=>8, 13=>16. More...
|
|
static int | NextPowerOf2 (int x) |
| Calls NextPowerOf2(uint). More...
|
|
static int | NextPowerOf2 (long x) |
| Calls NextPowerOf2(ulong). More...
|
|
static int | FindFirstOne (uint i) |
| Returns the bit position of the first '1' bit in a uint, or -1 the input is zero. More...
|
|
static int | FindFirstZero (uint i) |
| Returns the bit position of the first '0' bit in a uint, or -1 if there are no zeros. More...
|
|
static int | FindLastOne (uint i) |
| Returns the bit position of the first '1' bit in a uint, or -1 the input is zero. More...
|
|
static int | FindLastZero (uint i) |
|
static double | Int64BitsToDouble (long bits) |
|
static long | DoubleToInt64Bits (double value) |
|
static double | Int32BitsToSingle (int bits) |
|
static long | SingleToInt32Bits (float value) |
|
static float | NextHigher (float a) |
|
static float | NextLower (float a) |
|
static double | NextHigher (double num) |
|
static double | NextLower (double num) |
|
static double | ShiftLeft (double num, int amount) |
|
static double | ShiftRight (double num, int amount) |
|
static float | ShiftLeft (float num, int amount) |
|
static float | ShiftRight (float num, int amount) |
|
static int | ShiftLeft (int num, int amount) |
|
static long | ShiftLeft (long num, int amount) |
|
static int | ShiftRight (int num, int amount) |
|
static long | ShiftRight (long num, int amount) |
|
static T | ShiftLeft< T > (T num, int amount) |
|
static T | Min< T > (T a, T b) |
|
static T | Max< T > (T a, T b) |
|
static void | Swap< T > (ref T a, ref T b) |
|
static bool | SortPair< T > (ref T lo, ref T hi, Comparison< T > comp) |
|
static bool | SortPair< T > (ref T lo, ref T hi) |
|
static int | Average (int x, int y) |
| Computes the average of two integers. Will not overflow. More...
|
|
static long | Average (long x, long y) |
| Computes the average of two integers. Will not overflow. More...
|
|
static float | Average (float x, float y) |
| Computes the average of two numbers. Will not overflow. More...
|
|
static double | Average (double x, double y) |
| Computes the average of two numbers. Will not overflow. More...
|
|
static T | Average< T > (T x, T y) |
| Computes the average of two numbers. Slow. No overflow protection. More...
|
|
static int | Square (int x) |
|
static long | Square (long x) |
|
static uint | Square (uint x) |
|
static ulong | Square (ulong x) |
|
static float | Square (float x) |
|
static double | Square (double x) |
|
static int | Cube (int x) |
|
static long | Cube (long x) |
|
static uint | Cube (uint x) |
|
static ulong | Cube (ulong x) |
|
static float | Cube (float x) |
|
static double | Cube (double x) |
|
static bool | IsPrime (int num) |
| Returns true if num is a prime number, meaning that it is greater than 1 and is divisible only by 1 and itself. More...
|
|