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; } } }
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; } }
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); }
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; } } } }
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)); }
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); }
public override Interval_IEEE754 For(double inf, double sup) { return(Interval_IEEE754.For(inf, sup)); }
public override Interval_IEEE754 For(Rational r) { return(Interval_IEEE754.For(r)); }
public override Interval_IEEE754 For(uint u) { return(Interval_IEEE754.For(u)); }
public override Interval_IEEE754 For(sbyte s) { return(Interval_IEEE754.For(s)); }
public override Interval_IEEE754 For(long v) { return(Interval_IEEE754.For(v)); }
public override Interval_IEEE754 For(short v) { return(Interval_IEEE754.For(v)); }
public override Interval_IEEE754 IntervalLeftOpen(double sup) { return(Interval_IEEE754.For(double.NegativeInfinity, sup)); }
public override Interval_IEEE754 IntervalRightOpen(double inf) { return(Interval_IEEE754.For(inf, double.PositiveInfinity)); }
public override Interval_IEEE754 IntervalSingleton(double val) { return(Interval_IEEE754.For(val)); }