当前位置: 首页>>代码示例>>C#>>正文


C# BigInteger.IsNegative方法代码示例

本文整理汇总了C#中Microsoft.Scripting.Math.BigInteger.IsNegative方法的典型用法代码示例。如果您正苦于以下问题:C# BigInteger.IsNegative方法的具体用法?C# BigInteger.IsNegative怎么用?C# BigInteger.IsNegative使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.Scripting.Math.BigInteger的用法示例。


在下文中一共展示了BigInteger.IsNegative方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ToBinary

        private static string ToBinary(BigInteger val, bool includeType, bool lowercase) {
            Debug.Assert(!val.IsNegative());

            string digits;
            digits = ToDigits(val, 2, lowercase);
            
            if (includeType) {
                digits = (lowercase ? "0b" : "0B") + digits;
            }
            return digits;
        }
开发者ID:CookieEaters,项目名称:FireHTTP,代码行数:11,代码来源:LongOps.cs

示例2: ShiftOverflowCheck

 /// <summary>
 /// Test for shift overflow on negative BigIntegers
 /// </summary>
 /// <param name="self">Value before shifting</param>
 /// <param name="result">Value after shifting</param>
 /// <returns>-1 if we overflowed, otherwise result</returns>
 /// <remarks>
 /// Negative Bignums are supposed to look like they are stored in 2s complement infinite bit string, 
 /// a negative number should always have spare 1s available for on the left hand side for right shifting.
 /// E.g. 8 == ...0001000; -8 == ...1110111, where the ... means that the left hand value is repeated indefinitely.
 /// The test here checks whether we have overflowed into the infinite 1s.
 /// [Arguably this should get factored into the BigInteger class.]
 /// </remarks>
 private static BigInteger/*!*/ ShiftOverflowCheck(BigInteger/*!*/ self, BigInteger/*!*/ result) {
     if (self.IsNegative() && result.IsZero()) {
         return -1;
     }
     return result;
 }
开发者ID:joshholmes,项目名称:ironruby,代码行数:19,代码来源:BigNumOps.cs

示例3: RightShift

 public static object/*!*/ RightShift(BigInteger/*!*/ self, [NotNull]BigInteger/*!*/ other) {
     if (self.IsNegative()) {
         return -1;
     }
     return 0;
 }
开发者ID:joshholmes,项目名称:ironruby,代码行数:6,代码来源:BigNumOps.cs

示例4: ConvertBignumToFloat

 public static double ConvertBignumToFloat(BigInteger/*!*/ value) {
     double result;
     return value.TryToFloat64(out result) ? result : (value.IsNegative() ? Double.NegativeInfinity : Double.PositiveInfinity);
 }
开发者ID:teejayvanslyke,项目名称:ironruby,代码行数:4,代码来源:RubyOps.cs

示例5: RightShift

 public static object RightShift(BigInteger/*!*/ self, [NotNull]BigInteger/*!*/ other)
 {
     return self.IsNegative() ? ClrInteger.MinusOne : ClrInteger.Zero;
 }
开发者ID:TerabyteX,项目名称:main,代码行数:4,代码来源:ClrBigInteger.cs


注:本文中的Microsoft.Scripting.Math.BigInteger.IsNegative方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。