Abs() public method

public Abs ( ) : BigInteger
return BigInteger
示例#1
0
        // Like GetBitCount(Abs(x)), except 0 maps to 0
        public static int BitLength(BigInteger x) {
            if (x.IsZero()) {
                return 0;
            }

            return x.Abs().GetBitCount();
        }
示例#2
0
 public static object Abs(BigInteger/*!*/ self) {
     return Protocols.Normalize(self.Abs());
 }
示例#3
0
 public static object __abs__(BigInteger x) {
     return x.Abs();
 }
示例#4
0
 internal static string ToBinary(BigInteger val) {            
     string res = ToBinary(val.Abs(), true, true);
     if (val.IsNegative()) {
         res = "-" + res;
     }
     return res;
 }
示例#5
0
文件: math.cs 项目: m4dc4p/ironruby
 public static double asinh(BigInteger value) {
     if (value == 0) {
         return 0;
     }
     // rewrote ln(v0 + sqrt(v0**2 + 1)) for precision
     if (value.Abs() > 1) {
         return value.Log() + Math.Log(1.0 + Complex64.Hypot(1.0, 1.0 / value));
     } else {
         return Math.Log(value + Complex64.Hypot(1.0, value));
     }
 }