diff --git a/X10D/src/Math/NumberExtensions.cs b/X10D/src/Math/NumberExtensions.cs
index 12f00f8..b2c68a1 100644
--- a/X10D/src/Math/NumberExtensions.cs
+++ b/X10D/src/Math/NumberExtensions.cs
@@ -11,6 +11,22 @@ namespace X10D.Math;
///
public static class NumberExtensions
{
+ ///
+ /// Returns the number of digits in the current binary integer.
+ ///
+ /// The value whose digit count to compute.
+ /// The number of digits in .
+ public static int CountDigits(this TNumber value)
+ where TNumber : IBinaryInteger
+ {
+ if (TNumber.IsZero(value))
+ {
+ return 1;
+ }
+
+ return 1 + (int)System.Math.Floor(System.Math.Log10(System.Math.Abs(double.CreateChecked(value))));
+ }
+
///
/// Returns a value indicating whether the current value is evenly divisible by 2.
///