コード例 #1
0
        protected override void AssumeLeftLessThanK(Variable leftExp, Interval_IEEE754 k)
        {
            if (k.IsSingleton)
            {
                Interval_IEEE754 intv;
                if (k.LowerBound.IsZero())
                { // leftExp < 0
                    intv = Interval_IEEE754.For(Double.NegativeInfinity, -Double.Epsilon);
                }
                else  // We overapproximate
                {
                    intv = Interval_IEEE754.For(Double.NegativeInfinity, k.LowerBound - double.Epsilon);
                }

                Interval_IEEE754 prevIntv;
                if (this.TryGetValue(leftExp, out prevIntv))
                {
                    this[leftExp] = prevIntv.Meet(intv);
                }
                else
                {
                    this[leftExp] = intv;
                }
            }
        }
コード例 #2
0
        protected override void AssumeInDisInterval_Internal(Variable x, DisInterval disIntv)
        {
            Rational r;

            if (disIntv.TryGetSingletonValue(out r))
            {
                Interval_IEEE754 value;
                long             intValue;
                if (r.TryInt64(out intValue))
                {
                    value = Interval_IEEE754.For(intValue);
                }
                else
                {
                    value = Interval_IEEE754.For((double)r);
                }

                Interval_IEEE754 prev;
                if (this.TryGetValue(x, out prev))
                {
                    value = value.Meet(prev);
                }

                this[x] = value;
            }
        }
コード例 #3
0
        private Interval_IEEE754 IntervalForKLessThanRight(Interval_IEEE754 k, Variable leftExp)
        {
            if (k.IsSingleton)
            {
                if (k.LowerBound.IsZero())
                {
                    var kPlusEpsilon = Interval_IEEE754.For(Double.Epsilon, Double.PositiveInfinity);

                    Interval_IEEE754 prevIntv;
                    if (this.TryGetValue(leftExp, out prevIntv))
                    {
                        return(prevIntv.Meet(kPlusEpsilon));
                    }
                    else
                    {
                        return(kPlusEpsilon);
                    }
                }
                else  // We overapproximate
                {
                    var intv = Interval_IEEE754.For(k.LowerBound, Double.PositiveInfinity);
                    Interval_IEEE754 prevIntv;
                    if (this.TryGetValue(leftExp, out prevIntv))
                    {
                        return(prevIntv.Meet(intv));
                    }
                    else
                    {
                        return(intv);
                    }
                }
            }

            return(Interval_IEEE754.UnknownInterval);
        }
コード例 #4
0
        protected override void AssumeKLessThanRight(Interval_IEEE754 k, Variable leftExp)
        {
            if (k.IsSingleton)
            {
                if (k.LowerBound.IsZero())
                {
                    var kPlusEpsilon = Interval_IEEE754.For(Double.Epsilon, Double.PositiveInfinity);

                    Interval_IEEE754 prevIntv;
                    if (this.TryGetValue(leftExp, out prevIntv))
                    {
                        this[leftExp] = prevIntv.Meet(kPlusEpsilon);
                    }
                    else
                    {
                        this[leftExp] = kPlusEpsilon;
                    }
                }
                else  // We overapproximate
                {
                    var intv = Interval_IEEE754.For(k.LowerBound, Double.PositiveInfinity);
                    Interval_IEEE754 prevIntv;
                    if (this.TryGetValue(leftExp, out prevIntv))
                    {
                        this[leftExp] = prevIntv.Meet(intv);
                    }
                    else
                    {
                        this[leftExp] = intv;
                    }
                }
            }
        }
コード例 #5
0
                public override INumericalAbstractDomain <BoxedVariable <Variable>, BoxedExpression> Unary(APC pc, UnaryOperator op, bool overflow, bool unsigned, Variable dest, Variable source, INumericalAbstractDomain <BoxedVariable <Variable>, BoxedExpression> data)
                {
                    data = FloatTypesUnary(pc, op, dest, source, data);

                    // Handle the conversion from an int
                    if (op == UnaryOperator.Conv_r4 || op == UnaryOperator.Conv_r8)
                    {
                        var type = this.Context.ValueContext.GetType(this.Context.MethodContext.CFG.Post(pc), source);
                        if (type.IsNormal && this.DecoderForMetaData.IsIntegerType(type.Value))
                        {
                            var intv = this.DecoderForMetaData.GetDisIntervalForType(type.Value);

                            long low, upp;
                            if (intv.IsNormal() && intv.LowerBound.TryInt64(out low) && intv.UpperBound.TryInt64(out upp))
                            {
                                var floatIntv =
                                    op == UnaryOperator.Conv_r8 ?
                                    Interval_IEEE754.For((double)low, (double)upp) :
                                    Interval_IEEE754.For((float)low, (float)upp);

                                data.AssumeDomainSpecificFact(new DomainSpecificFact.AssumeInFloatInterval(new BoxedVariable <Variable>(dest), floatIntv));
                            }
                        }
                    }

                    return(base.Unary(pc, op, overflow, unsigned, dest, source, data));
                }
コード例 #6
0
        protected override IntervalEnvironment_IEEE754 <Variable, Expression> TestEqualToZero(Variable v)
        {
            var intv = Interval_IEEE754.For(0);
            Interval_IEEE754 prevVal;

            if (this.TryGetValue(v, out prevVal))
            {
                intv = prevVal.Meet(intv);
            }

            this[v] = intv;

            return(this);
        }
コード例 #7
0
 public override Interval_IEEE754 For(double inf, double sup)
 {
     return(Interval_IEEE754.For(inf, sup));
 }
コード例 #8
0
 public override Interval_IEEE754 For(Rational r)
 {
     return(Interval_IEEE754.For(r));
 }
コード例 #9
0
 public override Interval_IEEE754 For(uint u)
 {
     return(Interval_IEEE754.For(u));
 }
コード例 #10
0
 public override Interval_IEEE754 For(sbyte s)
 {
     return(Interval_IEEE754.For(s));
 }
コード例 #11
0
 public override Interval_IEEE754 For(long v)
 {
     return(Interval_IEEE754.For(v));
 }
コード例 #12
0
 public override Interval_IEEE754 For(short v)
 {
     return(Interval_IEEE754.For(v));
 }
コード例 #13
0
 public override Interval_IEEE754 IntervalLeftOpen(double sup)
 {
     return(Interval_IEEE754.For(double.NegativeInfinity, sup));
 }
コード例 #14
0
 public override Interval_IEEE754 IntervalRightOpen(double inf)
 {
     return(Interval_IEEE754.For(inf, double.PositiveInfinity));
 }
コード例 #15
0
 public override Interval_IEEE754 IntervalSingleton(double val)
 {
     return(Interval_IEEE754.For(val));
 }