當前位置: 首頁>>代碼示例>>C#>>正文


C# BigInteger.BitLength方法代碼示例

本文整理匯總了C#中BigInteger.BitLength方法的典型用法代碼示例。如果您正苦於以下問題:C# BigInteger.BitLength方法的具體用法?C# BigInteger.BitLength怎麽用?C# BigInteger.BitLength使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在BigInteger的用法示例。


在下文中一共展示了BigInteger.BitLength方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ExpandedDouble

 public ExpandedDouble(BigInteger frac, int binaryExp)
 {
     if (frac.BitLength() != 64)
     {
         throw new ArgumentException("bad bit length");
     }
     _significand = frac;
     _binaryExponent = binaryExp;
 }
開發者ID:missxiaohuang,項目名稱:Weekly,代碼行數:9,代碼來源:ExpandedDouble.cs

示例2: Normalise64bit

 public void Normalise64bit()
 {
     int oldBitLen = _significand.BitLength();
     int sc = oldBitLen - C_64;
     if (sc == 0)
     {
         return;
     }
     if (sc < 0)
     {
         throw new InvalidOperationException("Not enough precision");
     }
     _binaryExponent += sc;
     if (sc > 32)
     {
         int highShift = (sc - 1) & 0xFFFFE0;
         _significand = _significand>>(highShift);
         sc -= highShift;
         oldBitLen -= highShift;
     }
     if (sc < 1)
     {
         throw new InvalidOperationException();
     }
     _significand = Rounder.Round(_significand, sc);
     if (_significand.BitLength() > oldBitLen)
     {
         sc++;
         _binaryExponent++;
     }
     _significand = _significand>>(sc);
 }
開發者ID:JnS-Software-LLC,項目名稱:npoi,代碼行數:32,代碼來源:MutableFPNumber.cs

示例3: mulShift

 private void mulShift(BigInteger multiplicand, int multiplierShift)
 {
     _significand = _significand*multiplicand;
     _binaryExponent += multiplierShift;
     // check for too much precision
     int sc = (_significand.BitLength() - MIN_PRECISION) & unchecked((int)0xFFFFFFE0);
     // mask Makes multiples of 32 which optimises BigInt32.ShiftRight
     if (sc > 0)
     {
         // no need to round because we have at least 8 bits of extra precision
         _significand = _significand>>(sc);
         _binaryExponent += sc;
     }
 }
開發者ID:JnS-Software-LLC,項目名稱:npoi,代碼行數:14,代碼來源:MutableFPNumber.cs


注:本文中的BigInteger.BitLength方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。