Example #1
0
        public static void TestStringEqualRoundTrip(EFloat obj)
        {
            Assert.AreEqual(
                EDecimal.PositiveInfinity,
                EDecimal.FromSingle(Single.PositiveInfinity));
            Assert.AreEqual(
                EDecimal.NegativeInfinity,
                EDecimal.FromSingle(Single.NegativeInfinity));

            Assert.AreEqual(
                EFloat.PositiveInfinity,
                EFloat.FromDouble(Double.PositiveInfinity));
            Assert.AreEqual(
                EFloat.NegativeInfinity,
                EFloat.FromDouble(Double.NegativeInfinity));
            Assert.AreEqual(
                EFloat.PositiveInfinity,
                EFloat.FromSingle(Single.PositiveInfinity));
            Assert.AreEqual(
                EFloat.NegativeInfinity,
                EFloat.FromSingle(Single.NegativeInfinity));

            Assert.AreEqual(
                ERational.PositiveInfinity,
                ERational.FromDouble(Double.PositiveInfinity));
            Assert.AreEqual(
                ERational.NegativeInfinity,
                ERational.FromDouble(Double.NegativeInfinity));
            Assert.AreEqual(
                ERational.PositiveInfinity,
                ERational.FromSingle(Single.PositiveInfinity));
            Assert.AreEqual(
                ERational.NegativeInfinity,
                ERational.FromSingle(Single.NegativeInfinity));

            Assert.AreEqual(
                ERational.PositiveInfinity,
                ERational.FromEDecimal(EDecimal.PositiveInfinity));
            Assert.AreEqual(
                ERational.NegativeInfinity,
                ERational.FromEDecimal(EDecimal.NegativeInfinity));
            Assert.AreEqual(
                ERational.PositiveInfinity,
                ERational.FromEFloat(EFloat.PositiveInfinity));
            Assert.AreEqual(
                ERational.NegativeInfinity,
                ERational.FromEFloat(EFloat.NegativeInfinity));

            Assert.IsTrue(Double.IsPositiveInfinity(ERational.PositiveInfinity.ToDouble()));

            Assert.IsTrue(Double.IsNegativeInfinity(ERational.NegativeInfinity.ToDouble()));

            Assert.IsTrue(Single.IsPositiveInfinity(ERational.PositiveInfinity.ToSingle()));

            Assert.IsTrue(Single.IsNegativeInfinity(ERational.NegativeInfinity.ToSingle()));
        }
Example #2
0
 public ERational AsExtendedRational(object obj)
 {
     return(ERational.FromEFloat((EFloat)obj));
 }