mirror of
https://github.com/oliverbooth/X10D
synced 2024-11-22 13:28:47 +00:00
[ci skip] fix: define CountDigits in the correct file
I'm an idiot.
This commit is contained in:
parent
423fb90cc4
commit
39dfea7622
@ -11,6 +11,22 @@ namespace X10D.Math;
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static class BinaryIntegerExtensions
|
public static class BinaryIntegerExtensions
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the number of digits in the current binary integer.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value">The value whose digit count to compute.</param>
|
||||||
|
/// <returns>The number of digits in <paramref name="value" />.</returns>
|
||||||
|
public static int CountDigits<TNumber>(this TNumber value)
|
||||||
|
where TNumber : IBinaryInteger<TNumber>
|
||||||
|
{
|
||||||
|
if (TNumber.IsZero(value))
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1 + (int)System.Math.Floor(System.Math.Log10(System.Math.Abs(double.CreateChecked(value))));
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Computes the digital root of this integer.
|
/// Computes the digital root of this integer.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -11,22 +11,6 @@ namespace X10D.Math;
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static class NumberExtensions
|
public static class NumberExtensions
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Returns the number of digits in the current binary integer.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="value">The value whose digit count to compute.</param>
|
|
||||||
/// <returns>The number of digits in <paramref name="value" />.</returns>
|
|
||||||
public static int CountDigits<TNumber>(this TNumber value)
|
|
||||||
where TNumber : IBinaryInteger<TNumber>
|
|
||||||
{
|
|
||||||
if (TNumber.IsZero(value))
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1 + (int)System.Math.Floor(System.Math.Log10(System.Math.Abs(double.CreateChecked(value))));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns a value indicating whether the current value is evenly divisible by 2.
|
/// Returns a value indicating whether the current value is evenly divisible by 2.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
Loading…
Reference in New Issue
Block a user