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


C# BigDecimal.Equals方法代码示例

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


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

示例1: Equal

 public static bool Equal(RubyContext/*!*/ context, BigDecimal/*!*/ self, double other) {
     return self.Equals(BigDecimal.Create(GetConfig(context), other));
 }
开发者ID:mscottford,项目名称:ironruby,代码行数:3,代码来源:BigDecimalOps.cs

示例2: TestGetHashCode

 public void TestGetHashCode()
 {
     // anything that is equal must have the same hashCode
     BigDecimal hash = BigDecimal.Parse("1.00");
     BigDecimal hash2 = new BigDecimal(1.00D);
     Assert.IsTrue(hash.GetHashCode() != hash2.GetHashCode() && !hash.Equals(hash2),
                   "the hashCode of 1.00 and 1.00D is equal");
     hash2 = BigDecimal.Parse("1.0");
     Assert.IsTrue(hash.GetHashCode() != hash2.GetHashCode() && !hash.Equals(hash2),
                   "the hashCode of 1.0 and 1.00 is equal");
     BigInteger val = BigInteger.Parse("100");
     hash2 = new BigDecimal(val, 2);
     Assert.IsTrue(hash.GetHashCode() == hash2.GetHashCode() && hash.Equals(hash2),
                   "hashCode of 1.00 and 1.00(bigInteger) is not equal");
     hash = new BigDecimal(value, 2);
     hash2 = BigDecimal.Parse("-1233456.0000");
     Assert.IsTrue(hash.GetHashCode() != hash2.GetHashCode() && !hash.Equals(hash2),
                   "hashCode of 123459.08 and -1233456.0000 is not equal");
     hash2 = new BigDecimal(value.Negate(), 2);
     Assert.IsTrue(hash.GetHashCode() != hash2.GetHashCode() && !hash.Equals(hash2),
                   "hashCode of 123459.08 and -123459.08 is not equal");
 }
开发者ID:tupunco,项目名称:deveel-math,代码行数:22,代码来源:BigDecimalTest.cs

示例3: EqualsObject

 public void EqualsObject()
 {
     BigDecimal equal1 = new BigDecimal(1.00D);
     BigDecimal equal2 = BigDecimal.Parse("1.0");
     Assert.IsFalse(equal1.Equals(equal2), "1.00 and 1.0 should not be equal");
     equal2 = new BigDecimal(1.01D);
     Assert.IsFalse(equal1.Equals(equal2), "1.00 and 1.01 should not be equal");
     equal2 = BigDecimal.Parse("1.00");
     Assert.IsFalse(equal1.Equals(equal2), "1.00D and 1.00 should not be equal");
     BigInteger val = BigInteger.Parse("100");
     equal1 = BigDecimal.Parse("1.00");
     equal2 = new BigDecimal(val, 2);
     Assert.IsTrue(equal1.Equals(equal2), "1.00(string) and 1.00(bigInteger) should be equal");
     equal1 = new BigDecimal(100D);
     equal2 = BigDecimal.Parse("2.34576");
     Assert.IsFalse(equal1.Equals(equal2), "100D and 2.34576 should not be equal");
     Assert.IsFalse(equal1.Equals("23415"), "bigDecimal 100D does not equal string 23415");
 }
开发者ID:tupunco,项目名称:deveel-math,代码行数:18,代码来源:BigDecimalTest.cs


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