shiftRight() public method

public shiftRight ( int arg0 ) : global::java.math.BigInteger
arg0 int
return global::java.math.BigInteger
Example #1
0
 /// <summary>Calculate Log2 of a BigInteger object value.</summary>
 /// <remarks>Calculate Log2 of a BigInteger object value.</remarks>
 /// <param name="val">BigInteger object value which will calculate with log2</param>
 /// <returns>Result of calculating of val as double value</returns>
 public static double logBigInteger(BigInteger val)
 {
     double LOG2 = java.lang.Math.log(2.0);
     int blex = val.bitLength() - 1022;
     if (blex > 0)
     {
         val = val.shiftRight(blex);
     }
     double res = java.lang.Math.log(val.doubleValue());
     return blex > 0 ? res + blex * LOG2 : res;
 }