(Context ctx)
| 1989 | } |
| 1990 | |
| 1991 | public void floatingPointExample2(Context ctx) throws TestFailedException |
| 1992 | { |
| 1993 | System.out.println("FloatingPointExample2"); |
| 1994 | Log.append("FloatingPointExample2"); |
| 1995 | FPSort double_sort = ctx.mkFPSort(11, 53); |
| 1996 | FPRMSort rm_sort = ctx.mkFPRoundingModeSort(); |
| 1997 | |
| 1998 | FPRMExpr rm = (FPRMExpr)ctx.mkConst(ctx.mkSymbol("rm"), rm_sort); |
| 1999 | BitVecExpr x = (BitVecExpr)ctx.mkConst(ctx.mkSymbol("x"), ctx.mkBitVecSort(64)); |
| 2000 | FPExpr y = (FPExpr)ctx.mkConst(ctx.mkSymbol("y"), double_sort); |
| 2001 | FPExpr fp_val = ctx.mkFP(42, double_sort); |
| 2002 | |
| 2003 | BoolExpr c1 = ctx.mkEq(y, fp_val); |
| 2004 | BoolExpr c2 = ctx.mkEq(x, ctx.mkFPToBV(rm, y, 64, false)); |
| 2005 | BoolExpr c3 = ctx.mkEq(x, ctx.mkBV(42, 64)); |
| 2006 | BoolExpr c4 = ctx.mkEq(ctx.mkNumeral(42, ctx.getRealSort()), ctx.mkFPToReal(fp_val)); |
| 2007 | BoolExpr c5 = ctx.mkAnd(c1, c2, c3, c4); |
| 2008 | System.out.printf("c5 = %s%n", c5); |
| 2009 | |
| 2010 | /* Generic solver */ |
| 2011 | Solver s = ctx.mkSolver(); |
| 2012 | s.add(c5); |
| 2013 | |
| 2014 | if (s.check() != Status.SATISFIABLE) |
| 2015 | throw new TestFailedException(); |
| 2016 | |
| 2017 | System.out.printf("OK, model: %s%n", s.getModel()); |
| 2018 | } |
| 2019 | |
| 2020 | @SuppressWarnings("unchecked") |
| 2021 | public void optimizeExample(Context ctx) |
nothing calls this directly
no test coverage detected