mirror of
https://github.com/oliverbooth/X10D
synced 2024-11-12 22:35:43 +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>
|
||||
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>
|
||||
/// Computes the digital root of this integer.
|
||||
/// </summary>
|
||||
|
@ -11,22 +11,6 @@ namespace X10D.Math;
|
||||
/// </summary>
|
||||
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>
|
||||
/// Returns a value indicating whether the current value is evenly divisible by 2.
|
||||
/// </summary>
|
||||
|
Loading…
Reference in New Issue
Block a user