public void NegativeRealFromBigDec() { var builder = GetSimpleBuilder(); var constant = builder.ConstantReal(BigDec.FromInt(-5)); Assert.AreEqual("-5e0", constant.ToString()); CheckType(constant, t => t.IsReal); }
public void testReal(bool useStringInterface) { var ccB = new ConstantCachingExprBuilder(this.GetSimpleBuilder()); for (BigDec value = BigDec.FromInt(-20); value <= BigDec.FromInt(20); value += BigDec.FromString("0.1")) { var asString = value.ToString(); var realExpr = useStringInterface ? ccB.ConstantReal(asString) : ccB.ConstantReal(value); var realExpr2 = useStringInterface ? ccB.ConstantReal(asString) : ccB.ConstantReal(value); Assert.AreSame(realExpr, realExpr2); } }
public Microsoft.Boogie.LiteralExpr GetAssignment(SymbolicVariable SV) { if (SV.TypedIdent.Type.IsBv) { int width = SV.TypedIdent.Type.BvBits; return(new LiteralExpr(Token.NoToken, BigNum.FromInt(defaultValue), width)); } else if (SV.TypedIdent.Type.IsBool) { return(defaultValue > 0 ? Expr.True : Expr.False); } else if (SV.TypedIdent.Type.IsInt) { return(new LiteralExpr(Token.NoToken, BigNum.FromInt(defaultValue))); } else if (SV.TypedIdent.Type.IsReal) { return(new LiteralExpr(Token.NoToken, BigDec.FromInt(defaultValue))); } else { throw new NotImplementedException(); } }