Esempio n. 1
0
        public static ExtendedZ PositiveInfinity()
        {
            var pos = new ExtendedZ();

            pos.PositiveInf = true;
            return(pos);
        }
Esempio n. 2
0
        public static ExtendedZ NegativeInfinity()
        {
            var nega = new ExtendedZ();

            nega.NegativeInf = true;
            return(nega);
        }
Esempio n. 3
0
        private IADomain ReadTransfer(ReadStmt readStmt, IADomain domain)
        {
            var newDomain = CopyDomain(domain);

            if (domain.IsBottom())
            {
                return(newDomain);
            }

            var ident = readStmt.Left switch
            {
                VarAccess varAccess => varAccess.Left,
                ArrayAccess arrayAccess => arrayAccess.Left,
                RecordAccess recordAccess => recordAccess.Right,
            };

            if (readStmt.Left is ArrayAccess)
            {
                var ra            = readStmt.Left as ArrayAccess;
                var indexInterval = IAUtil.Arithmetic(ra.Right, domain);
                if (indexInterval.IsBottom)
                {
                    return(Bottom().GetDomain());
                }
            }

            newDomain[ident] = new Interval(ExtendedZ.NegativeInfinity(), ExtendedZ.PositiveInfinity()).ToIntervalK(_program);
            return(newDomain);
        }
Esempio n. 4
0
        public static ExtendedZ Max(ExtendedZ left, ExtendedZ right)
        {
            if (left.PositiveInf || right.PositiveInf)
            {
                return(ExtendedZ.PositiveInfinity());
            }

            if (left.NegativeInf)
            {
                return(right);
            }

            if (right.NegativeInf)
            {
                return(left);
            }

            return(new ExtendedZ(BigInteger.Max(left.Value, right.Value)));
        }
Esempio n. 5
0
 public Interval(ExtendedZ lower, ExtendedZ upper)
 {
     LowerBound = lower;
     UpperBound = upper;
 }