public abstract class AbstractFloatingPointFormulaManager<TFormulaInfo,TType,TEnv,TFuncDecl> extends Object implements FloatingPointFormulaManager
FloatingPointFormulaManager. It handles all the unwrapping and
wrapping from and to the Formula instances, such that the concrete class needs to handle
only its own internal types.
For multiply(FloatingPointFormula, FloatingPointFormula), and divide(FloatingPointFormula, FloatingPointFormula) this class even offers an implementation
based on UFs. Sub-classes are supposed to override them if they can implement these operations
more precisely (for example multiplication with constants should be supported by all solvers and
implemented by all sub-classes).
| Modifier and Type | Field and Description |
|---|---|
protected FormulaCreator<TFormulaInfo,TType,TEnv,TFuncDecl> |
formulaCreator |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractFloatingPointFormulaManager(FormulaCreator<TFormulaInfo,TType,TEnv,TFuncDecl> pCreator) |
protected final FormulaCreator<TFormulaInfo,TType,TEnv,TFuncDecl> formulaCreator
protected AbstractFloatingPointFormulaManager(FormulaCreator<TFormulaInfo,TType,TEnv,TFuncDecl> pCreator)
protected abstract TFormulaInfo getDefaultRoundingMode()
protected abstract TFormulaInfo getRoundingModeImpl(FloatingPointRoundingMode pFloatingPointRoundingMode)
protected FloatingPointFormula wrap(TFormulaInfo pTerm)
public FloatingPointFormula makeNumber(Rational n, FormulaType.FloatingPointType type)
makeNumber in interface FloatingPointFormulaManagerpublic FloatingPointFormula makeNumber(Rational n, FormulaType.FloatingPointType type, FloatingPointRoundingMode pFloatingPointRoundingMode)
makeNumber in interface FloatingPointFormulaManagerpublic FloatingPointFormula makeNumber(double n, FormulaType.FloatingPointType type)
makeNumber in interface FloatingPointFormulaManagerpublic FloatingPointFormula makeNumber(double n, FormulaType.FloatingPointType type, FloatingPointRoundingMode pFloatingPointRoundingMode)
makeNumber in interface FloatingPointFormulaManagerprotected abstract TFormulaInfo makeNumberImpl(double n, FormulaType.FloatingPointType type, TFormulaInfo pFloatingPointRoundingMode)
public FloatingPointFormula makeNumber(BigDecimal n, FormulaType.FloatingPointType type)
makeNumber in interface FloatingPointFormulaManagerpublic FloatingPointFormula makeNumber(BigDecimal n, FormulaType.FloatingPointType type, FloatingPointRoundingMode pFloatingPointRoundingMode)
makeNumber in interface FloatingPointFormulaManagerprotected abstract TFormulaInfo makeNumberImpl(BigDecimal n, FormulaType.FloatingPointType type, TFormulaInfo pFloatingPointRoundingMode)
public FloatingPointFormula makeNumber(String n, FormulaType.FloatingPointType type)
makeNumber in interface FloatingPointFormulaManagerpublic FloatingPointFormula makeNumber(String n, FormulaType.FloatingPointType type, FloatingPointRoundingMode pFloatingPointRoundingMode)
makeNumber in interface FloatingPointFormulaManagerprotected abstract TFormulaInfo makeNumberImpl(String n, FormulaType.FloatingPointType type, TFormulaInfo pFloatingPointRoundingMode)
public FloatingPointFormula makeVariable(String pVar, FormulaType.FloatingPointType pType)
FloatingPointFormulaManagerPlease make sure that the given name is valid in SMT-LIB2. Take a look at FormulaManager.isValidName(java.lang.String) for further information.
This method does not quote or unquote the given name, but uses the plain name "AS IS".
Formula.toString() can return a different String than the given one.
makeVariable in interface FloatingPointFormulaManagerprotected abstract TFormulaInfo makeVariableImpl(String pVar, FormulaType.FloatingPointType pType)
public FloatingPointFormula makePlusInfinity(FormulaType.FloatingPointType pType)
makePlusInfinity in interface FloatingPointFormulaManagerprotected abstract TFormulaInfo makePlusInfinityImpl(FormulaType.FloatingPointType pType)
public FloatingPointFormula makeMinusInfinity(FormulaType.FloatingPointType pType)
makeMinusInfinity in interface FloatingPointFormulaManagerprotected abstract TFormulaInfo makeMinusInfinityImpl(FormulaType.FloatingPointType pType)
public FloatingPointFormula makeNaN(FormulaType.FloatingPointType pType)
makeNaN in interface FloatingPointFormulaManagerprotected abstract TFormulaInfo makeNaNImpl(FormulaType.FloatingPointType pType)
public <T extends Formula> T castTo(FloatingPointFormula pNumber, FormulaType<T> pTargetType)
castTo in interface FloatingPointFormulaManagerpublic <T extends Formula> T castTo(FloatingPointFormula number, FormulaType<T> targetType, FloatingPointRoundingMode pFloatingPointRoundingMode)
castTo in interface FloatingPointFormulaManagerprotected abstract TFormulaInfo castToImpl(TFormulaInfo pNumber, FormulaType<?> pTargetType, TFormulaInfo pRoundingMode)
public FloatingPointFormula castFrom(Formula pNumber, boolean pSigned, FormulaType.FloatingPointType pTargetType)
FloatingPointFormulaManagerFloatingPointFormula from another compatible formula. This method uses the
default rounding mode.
Compatible formula types are all numeral types and bitvector types. It is also possible to cast a floating-point number into another floating-point type. We do not support casting from boolean or array types. We try to keep an exact representation, however fall back to rounding if needed.
castFrom in interface FloatingPointFormulaManagerpNumber - the source formula of compatible typepSigned - if a BitvectorFormula is given as source, we additionally use this flag.
Otherwise we ignore it.pTargetType - the type of the resulting formulapublic FloatingPointFormula castFrom(Formula number, boolean signed, FormulaType.FloatingPointType targetType, FloatingPointRoundingMode pFloatingPointRoundingMode)
FloatingPointFormulaManagerFloatingPointFormula from another compatible formula.
Compatible formula types are all numeral types and bitvector types. It is also possible to cast a floating-point number into another floating-point type. We do not support casting from boolean or array types. We try to keep an exact representation, however fall back to rounding if needed.
castFrom in interface FloatingPointFormulaManagernumber - the source formula of compatible typesigned - if a BitvectorFormula is given as source, we additionally use this flag.
Otherwise we ignore it.targetType - the type of the resulting formulapFloatingPointRoundingMode - if rounding is needed, we apply the rounding mode.protected abstract TFormulaInfo castFromImpl(TFormulaInfo pNumber, boolean pSigned, FormulaType.FloatingPointType pTargetType, TFormulaInfo pRoundingMode)
public FloatingPointFormula fromIeeeBitvector(BitvectorFormula pNumber, FormulaType.FloatingPointType pTargetType)
FloatingPointFormulaManagerNote: This method will return a value that is (numerically) far away from the original
value. This method is completely different from FloatingPointFormulaManager.castFrom(org.sosy_lab.java_smt.api.Formula, boolean, org.sosy_lab.java_smt.api.FormulaType.FloatingPointType), which will produce a
floating-point value close to the numeral value.
fromIeeeBitvector in interface FloatingPointFormulaManagerprotected abstract TFormulaInfo fromIeeeBitvectorImpl(TFormulaInfo pNumber, FormulaType.FloatingPointType pTargetType)
public BitvectorFormula toIeeeBitvector(FloatingPointFormula pNumber)
FloatingPointFormulaManagertoIeeeBitvector in interface FloatingPointFormulaManagerprotected abstract TFormulaInfo toIeeeBitvectorImpl(TFormulaInfo pNumber)
public FloatingPointFormula negate(FloatingPointFormula pNumber)
negate in interface FloatingPointFormulaManagerprotected abstract TFormulaInfo negate(TFormulaInfo pParam1)
public FloatingPointFormula add(FloatingPointFormula pNumber1, FloatingPointFormula pNumber2)
add in interface FloatingPointFormulaManagerpublic FloatingPointFormula add(FloatingPointFormula number1, FloatingPointFormula number2, FloatingPointRoundingMode pFloatingPointRoundingMode)
add in interface FloatingPointFormulaManagerprotected abstract TFormulaInfo add(TFormulaInfo pParam1, TFormulaInfo pParam2, TFormulaInfo pRoundingMode)
public FloatingPointFormula subtract(FloatingPointFormula pNumber1, FloatingPointFormula pNumber2)
subtract in interface FloatingPointFormulaManagerpublic FloatingPointFormula subtract(FloatingPointFormula number1, FloatingPointFormula number2, FloatingPointRoundingMode pFloatingPointRoundingMode)
subtract in interface FloatingPointFormulaManagerprotected abstract TFormulaInfo subtract(TFormulaInfo pParam1, TFormulaInfo pParam2, TFormulaInfo pFloatingPointRoundingMode)
public FloatingPointFormula divide(FloatingPointFormula pNumber1, FloatingPointFormula pNumber2)
divide in interface FloatingPointFormulaManagerpublic FloatingPointFormula divide(FloatingPointFormula number1, FloatingPointFormula number2, FloatingPointRoundingMode pFloatingPointRoundingMode)
divide in interface FloatingPointFormulaManagerprotected abstract TFormulaInfo divide(TFormulaInfo pParam1, TFormulaInfo pParam2, TFormulaInfo pFloatingPointRoundingMode)
public FloatingPointFormula multiply(FloatingPointFormula pNumber1, FloatingPointFormula pNumber2)
multiply in interface FloatingPointFormulaManagerpublic FloatingPointFormula multiply(FloatingPointFormula number1, FloatingPointFormula number2, FloatingPointRoundingMode pFloatingPointRoundingMode)
multiply in interface FloatingPointFormulaManagerprotected abstract TFormulaInfo multiply(TFormulaInfo pParam1, TFormulaInfo pParam2, TFormulaInfo pFloatingPointRoundingMode)
public BooleanFormula assignment(FloatingPointFormula pNumber1, FloatingPointFormula pNumber2)
FloatingPointFormulaManagerequal for other
theories.assignment in interface FloatingPointFormulaManagerprotected abstract TFormulaInfo assignment(TFormulaInfo pParam1, TFormulaInfo pParam2)
public BooleanFormula equalWithFPSemantics(FloatingPointFormula pNumber1, FloatingPointFormula pNumber2)
FloatingPointFormulaManagerFloatingPointFormulaManager.assignment(FloatingPointFormula, FloatingPointFormula).equalWithFPSemantics in interface FloatingPointFormulaManagerprotected abstract TFormulaInfo equalWithFPSemantics(TFormulaInfo pParam1, TFormulaInfo pParam2)
public BooleanFormula greaterThan(FloatingPointFormula pNumber1, FloatingPointFormula pNumber2)
greaterThan in interface FloatingPointFormulaManagerprotected abstract TFormulaInfo greaterThan(TFormulaInfo pParam1, TFormulaInfo pParam2)
public BooleanFormula greaterOrEquals(FloatingPointFormula pNumber1, FloatingPointFormula pNumber2)
greaterOrEquals in interface FloatingPointFormulaManagerprotected abstract TFormulaInfo greaterOrEquals(TFormulaInfo pParam1, TFormulaInfo pParam2)
public BooleanFormula lessThan(FloatingPointFormula pNumber1, FloatingPointFormula pNumber2)
lessThan in interface FloatingPointFormulaManagerprotected abstract TFormulaInfo lessThan(TFormulaInfo pParam1, TFormulaInfo pParam2)
public BooleanFormula lessOrEquals(FloatingPointFormula pNumber1, FloatingPointFormula pNumber2)
lessOrEquals in interface FloatingPointFormulaManagerprotected abstract TFormulaInfo lessOrEquals(TFormulaInfo pParam1, TFormulaInfo pParam2)
public BooleanFormula isNaN(FloatingPointFormula pNumber)
isNaN in interface FloatingPointFormulaManagerprotected abstract TFormulaInfo isNaN(TFormulaInfo pParam)
public BooleanFormula isInfinity(FloatingPointFormula pNumber)
isInfinity in interface FloatingPointFormulaManagerprotected abstract TFormulaInfo isInfinity(TFormulaInfo pParam)
public BooleanFormula isZero(FloatingPointFormula pNumber)
isZero in interface FloatingPointFormulaManagerprotected abstract TFormulaInfo isZero(TFormulaInfo pParam)
public BooleanFormula isSubnormal(FloatingPointFormula pNumber)
isSubnormal in interface FloatingPointFormulaManagerprotected abstract TFormulaInfo isSubnormal(TFormulaInfo pParam)
public BooleanFormula isNormal(FloatingPointFormula pNumber)
isNormal in interface FloatingPointFormulaManagerprotected abstract TFormulaInfo isNormal(TFormulaInfo pParam)
public BooleanFormula isNegative(FloatingPointFormula pNumber)
FloatingPointFormulaManagerisNegative in interface FloatingPointFormulaManagerprotected abstract TFormulaInfo isNegative(TFormulaInfo pParam)
public FloatingPointFormula round(FloatingPointFormula pFormula, FloatingPointRoundingMode pRoundingMode)
round in interface FloatingPointFormulaManagerprotected abstract TFormulaInfo round(TFormulaInfo pFormula, FloatingPointRoundingMode pRoundingMode)
protected final FormulaCreator<TFormulaInfo,TType,TEnv,TFuncDecl> getFormulaCreator()
protected final TType toSolverType(FormulaType<?> formulaType)