Search in sources :

Example 1 with FloatingPointConvertSort

use of edu.stanford.CVC4.FloatingPointConvertSort in project java-smt by sosy-lab.

the class CVC4FloatingPointFormulaManager method castToImpl.

@Override
protected Expr castToImpl(Expr pNumber, FormulaType<?> pTargetType, Expr pRoundingMode) {
    if (pTargetType.isFloatingPointType()) {
        FloatingPointType targetType = (FloatingPointType) pTargetType;
        FloatingPointConvertSort fpConvertSort = new FloatingPointConvertSort(getFPSize(targetType));
        Expr op = exprManager.mkConst(new FloatingPointToFPFloatingPoint(fpConvertSort));
        return exprManager.mkExpr(op, pRoundingMode, pNumber);
    } else if (pTargetType.isBitvectorType()) {
        BitvectorType targetType = (BitvectorType) pTargetType;
        Expr op = exprManager.mkConst(new FloatingPointToSBV(targetType.getSize()));
        return exprManager.mkExpr(op, pRoundingMode, pNumber);
    } else if (pTargetType.isRationalType()) {
        return exprManager.mkExpr(Kind.FLOATINGPOINT_TO_REAL, pNumber);
    } else {
        return genericCast(pNumber, pTargetType);
    }
}
Also used : FloatingPointToSBV(edu.stanford.CVC4.FloatingPointToSBV) Expr(edu.stanford.CVC4.Expr) FloatingPointConvertSort(edu.stanford.CVC4.FloatingPointConvertSort) BitvectorType(org.sosy_lab.java_smt.api.FormulaType.BitvectorType) FloatingPointToFPFloatingPoint(edu.stanford.CVC4.FloatingPointToFPFloatingPoint) FloatingPointType(org.sosy_lab.java_smt.api.FormulaType.FloatingPointType)

Aggregations

Expr (edu.stanford.CVC4.Expr)1 FloatingPointConvertSort (edu.stanford.CVC4.FloatingPointConvertSort)1 FloatingPointToFPFloatingPoint (edu.stanford.CVC4.FloatingPointToFPFloatingPoint)1 FloatingPointToSBV (edu.stanford.CVC4.FloatingPointToSBV)1 BitvectorType (org.sosy_lab.java_smt.api.FormulaType.BitvectorType)1 FloatingPointType (org.sosy_lab.java_smt.api.FormulaType.FloatingPointType)1