1
0
mirror of https://github.com/oliverbooth/X10D synced 2024-11-09 23:45:42 +00:00

[ci skip] fix: define CountDigits in the correct file

I'm an idiot.
This commit is contained in:
Oliver Booth 2023-08-25 02:42:51 +01:00
parent 423fb90cc4
commit 39dfea7622
Signed by: oliverbooth
GPG Key ID: B89D139977693FED
2 changed files with 16 additions and 16 deletions

View File

@ -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>

View File

@ -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>