/// <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); }
public static EFloat FromLegacy(ExtendedFloat ef) { return(ExtendedFloat.FromLegacy(ef)); }
public static ExtendedFloat ToLegacy(EFloat ef) { return(ExtendedFloat.ToLegacy(ef)); }
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()); }
public static EFloat FromLegacy(ExtendedFloat ef) { return ExtendedFloat.FromLegacy(ef); }