Class ByteExtensions
Math-related extension methods for
Inheritance
Namespace: X10D.Math
Assembly: X10D.dll
Syntax
public static class ByteExtensions : object
Methods
| Improve this Doc View SourceCountDigits(Byte)
Returns the number of digits in the current 8-bit unsigned integer.
Declaration
public static int CountDigits(this byte value)
Parameters
Type | Name | Description |
---|---|---|
System.Byte | value | The value whose digit count to compute. |
Returns
Type | Description |
---|---|
System.Int32 | The number of digits in |
DigitalRoot(Byte)
Computes the digital root of this 8-bit integer.
Declaration
public static byte DigitalRoot(this byte value)
Parameters
Type | Name | Description |
---|---|---|
System.Byte | value | The value whose digital root to compute. |
Returns
Type | Description |
---|---|
System.Byte | The digital root of |
Remarks
The digital root is defined as the recursive sum of digits until that result is a single digit.
Factorial(Byte)
Returns the factorial of the current 8-bit unsigned integer.
Declaration
public static long Factorial(this byte value)
Parameters
Type | Name | Description |
---|---|---|
System.Byte | value | The value whose factorial to compute. |
Returns
Type | Description |
---|---|
System.Int64 | The factorial of |
GreatestCommonFactor(Byte, Byte)
Calculates the greatest common factor between the current 8-bit unsigned integer, and another 8-bit unsigned integer.
Declaration
public static byte GreatestCommonFactor(this byte value, byte other)
Parameters
Type | Name | Description |
---|---|---|
System.Byte | value | The first value. |
System.Byte | other | The second value. |
Returns
Type | Description |
---|---|
System.Byte | The greatest common factor between |
IsEven(Byte)
Returns a value indicating whether the current value is evenly divisible by 2.
Declaration
public static bool IsEven(this byte value)
Parameters
Type | Name | Description |
---|---|---|
System.Byte | value | The value whose parity to check. |
Returns
Type | Description |
---|---|
System.Boolean | true if |
IsOdd(Byte)
Returns a value indicating whether the current value is not evenly divisible by 2.
Declaration
public static bool IsOdd(this byte value)
Parameters
Type | Name | Description |
---|---|---|
System.Byte | value | The value whose parity to check. |
Returns
Type | Description |
---|---|
System.Boolean | true if |
IsPrime(Byte)
Returns a value indicating whether the current value is a prime number.
Declaration
public static bool IsPrime(this byte value)
Parameters
Type | Name | Description |
---|---|---|
System.Byte | value | The value whose primality to check. |
Returns
Type | Description |
---|---|
System.Boolean | true if |
LowestCommonMultiple(Byte, Byte)
Calculates the lowest common multiple between the current 8-bit signed integer, and another 8-bit signed integer.
Declaration
public static byte LowestCommonMultiple(this byte value, byte other)
Parameters
Type | Name | Description |
---|---|---|
System.Byte | value | The first value. |
System.Byte | other | The second value. |
Returns
Type | Description |
---|---|
System.Byte | The lowest common multiple between |
MultiplicativePersistence(Byte)
Returns the multiplicative persistence of a specified value.
Declaration
public static int MultiplicativePersistence(this byte value)
Parameters
Type | Name | Description |
---|---|---|
System.Byte | value | The value whose multiplicative persistence to calculate. |
Returns
Type | Description |
---|---|
System.Int32 | The multiplicative persistence. |
Remarks
Multiplicative persistence is defined as the recursive digital product until that product is a single digit.
Wrap(Byte, Byte)
Wraps the current 8-bit unsigned integer between 0 and a high value.
Declaration
public static byte Wrap(this byte value, byte length)
Parameters
Type | Name | Description |
---|---|---|
System.Byte | value | The value to wrap. |
System.Byte | length | The exclusive upper bound. |
Returns
Type | Description |
---|---|
System.Byte | The wrapped value. |
Wrap(Byte, Byte, Byte)
Wraps the current 8-bit unsigned integer between a low and a high value.
Declaration
public static byte Wrap(this byte value, byte low, byte high)
Parameters
Type | Name | Description |
---|---|---|
System.Byte | value | The value to wrap. |
System.Byte | low | The inclusive lower bound. |
System.Byte | high | The exclusive upper bound. |
Returns
Type | Description |
---|---|
System.Byte | The wrapped value. |