Пример #1
0
        protected override IDataItem TestFunc(IDataItem p1, IDataItem p2)
        {
            var u = p1.ToRational().Value;
            var v = p2.ToInt32().Value;
            var w = u < v ? 1U : 0U;

            return(new UInt32DataItem(w));
        }
        protected override IDataItem TestFunc(IDataItem p1, IDataItem p2)
        {
            var u = p1.ToInt32().Value;
            var v = p2.ToBigInt().Value;
            var w = u & v;

            return(new BigIntDataItem(w));
        }
        protected override IDataItem TestFunc(IDataItem p1, IDataItem p2)
        {
            var u = p1.ToInt32().Value;
            var v = p2.ToUBigInt().Value;
            var w = u >= v;

            return(new UInt32DataItem(w ? 1U : 0U));
        }
Пример #4
0
        protected override IDataItem TestFunc(IDataItem p1, IDataItem p2)
        {
            var u = p1.ToUBigInt().Value;
            var v = p2.ToInt32().Value;
            var w = u.Remainder(v);

            return(new UInt32DataItem(w));
        }
Пример #5
0
        protected override IDataItem TestFunc(IDataItem p1, IDataItem p2)
        {
            var u = p1.ToRational().Value;
            var v = p2.ToInt32().Value;
            var w = Rational.Pow(u, v);

            return(new RationalDataItem(w));
        }
        protected override IDataItem TestFunc(IDataItem p1, IDataItem p2)
        {
            var u = p1.ToInt32().Value;
            var v = p2.ToUBigInt().Value;
            var w = u.CompareTo(v);

            return(new Int32DataItem(w));
        }
        protected override IDataItem TestFunc(IDataItem p1, IDataItem p2)
        {
            var u = p1.ToUBigInt().Value;
            var v = p2.ToInt32().Value;
            var w = u.GreatestCommonDivisor(v);

            return(new UBigIntDataItem(w));
        }
        protected override IDataItem TestFunc(IDataItem p1, IDataItem p2)
        {
            var u = p1.ToUBigInt().Value;
            var v = p2.ToInt32().Value;
            var w = u.LeftShift(v);

            return(new UBigIntDataItem(w));
        }
        protected override IDataItem TestFunc(IDataItem p1, IDataItem p2)
        {
            var u = p1.ToUBigInt().Value;
            var v = p2.ToInt32().Value;
            var w = u.DivideExactly(v);

            return(new BigIntDataItem(w));
        }
Пример #10
0
        protected override IDataItem TestFunc(IDataItem p1, IDataItem p2)
        {
            var u = p1.ToRational().Value;
            var v = (RoundingMode)p2.ToInt32().Value;
            var w = u.Round(v);

            return(new BigIntDataItem(w));
        }
Пример #11
0
        protected override IDataItem TestFunc(IDataItem p1, IDataItem p2)
        {
            var u = p1.ToInt32().Value;
            var v = p2.ToUInt32().Value;
            var w = BigInt.Pow(u, v);

            return(new BigIntDataItem(w));
        }
Пример #12
0
        protected override IDataItem TestFunc(IDataItem p1, IDataItem p2, IDataItem p3)
        {
            var s = p1.ToXString().Value;
            var f = p2.ToInt32().Value;
            var n = p3.ToNumberFormatInfo().Value;
            var r = BigInt.Parse(s, (NumberStyles)f, n);

            return(new BigIntDataItem(r));
        }
        protected override IDataItem TestFunc(IDataItem p1, IDataItem p2, IDataItem p3)
        {
            var x = p1.ToRational().Value;
            var d = p2.ToInt32().Value;
            var m = (RoundingMode)p3.ToInt32().Value;
            var r = x.Round(d, m);

            return(new RationalDataItem(r));
        }
        protected override IDataItem TestFunc(IDataItem p1, IDataItem p2, out IDataItem r2)
        {
            var    u = p1.ToBigInt().Value;
            var    v = p2.ToInt32().Value;
            BigInt r;
            var    q = BigInt.DivRem(u, v, out r);

            r2 = new BigIntDataItem(r);
            return(new BigIntDataItem(q));
        }
Пример #15
0
        protected override IDataItem TestFunc(IDataItem p1, IDataItem p2, IDataItem p3, out IDataItem r2)
        {
            var     s = p1.ToXString().Value;
            var     f = p2.ToInt32().Value;
            var     n = p3.ToNumberFormatInfo().Value;
            UBigInt v;
            var     r = UBigInt.TryParse(s, (NumberStyles)(int)f, n, out v);

            r2 = new UBigIntDataItem(v);
            return(new UInt32DataItem(r ? 1U : 0U));
        }