示例#1
0
 /// <include file='../docs.xml'
 /// path='docs/doc[@name="M:PeterO.TrapException.#ctor(System.Int32,PeterO.PrecisionContext,System.Object)"]/*'/>
 public TrapException(int flag, PrecisionContext ctx, Object result)
     : base(String.Empty)
 {
     Object wrappedResult = result;
       var ed = result as EDecimal;
       var er = result as ERational;
       var ef = result as EFloat;
       if (ed != null) {
      wrappedResult = new ExtendedDecimal(ed);
     }
       if (er != null) {
      wrappedResult = new ExtendedRational(er);
     }
       if (ef != null) {
      wrappedResult = new ExtendedFloat(ef);
     }
       this.ete = new ETrapException(
       flag,
       ctx == null ? null : ctx.Ec,
       wrappedResult);
 }
示例#2
0
 public static EFloat FromLegacy(ExtendedFloat ef)
 {
     return(ExtendedFloat.FromLegacy(ef));
 }
示例#3
0
 public static ExtendedFloat ToLegacy(EFloat ef)
 {
     return(ExtendedFloat.ToLegacy(ef));
 }
示例#4
0
文件: CBORTest.cs 项目: KSLcom/CBOR
 public void TestExtendedFloatDecFrac()
 {
     ExtendedFloat bf;
       bf = ExtendedFloat.FromInt64(20);
       Assert.AreEqual("20", ExtendedDecimal.FromExtendedFloat(bf).ToString());
       bf = new ExtendedFloat((BigInteger)3, (BigInteger)(-1));
       Assert.AreEqual("1.5", ExtendedDecimal.FromExtendedFloat(bf).ToString());
       bf = new ExtendedFloat((BigInteger)(-3), (BigInteger)(-1));
       Assert.AreEqual("-1.5", ExtendedDecimal.FromExtendedFloat(bf).ToString());
       ExtendedDecimal df;
       df = ExtendedDecimal.FromInt64(20);
       Assert.AreEqual("20", df.ToExtendedFloat().ToString());
       df = ExtendedDecimal.FromInt64(-20);
       Assert.AreEqual("-20", df.ToExtendedFloat().ToString());
       df = new ExtendedDecimal((BigInteger)15, (BigInteger)(-1));
       Assert.AreEqual("1.5", df.ToExtendedFloat().ToString());
       df = new ExtendedDecimal((BigInteger)(-15), (BigInteger)(-1));
       Assert.AreEqual("-1.5", df.ToExtendedFloat().ToString());
 }
示例#5
0
 public static EFloat FromLegacy(ExtendedFloat ef) {
   return ExtendedFloat.FromLegacy(ef);
 }