Interface FloatingPointFormulaManager
- All Known Implementing Classes:
AbstractFloatingPointFormulaManager
Most operations are overloaded: there is an option of either using the default rounding mode
(set via the option solver.floatingPointRoundingMode), or providing the rounding mode
explicitly.
-
Method Summary
Modifier and TypeMethodDescriptionabs(FloatingPointFormula number) add(FloatingPointFormula number1, FloatingPointFormula number2) add(FloatingPointFormula number1, FloatingPointFormula number2, FloatingPointRoundingMode pFloatingPointRoundingMode) assignment(FloatingPointFormula number1, FloatingPointFormula number2) Create a term for assigning one floating-point term to another.castFrom(Formula source, boolean signed, FormulaType.FloatingPointType targetType) Build aFloatingPointFormulafrom another compatible formula.castFrom(Formula source, boolean signed, FormulaType.FloatingPointType targetType, FloatingPointRoundingMode pFloatingPointRoundingMode) Build aFloatingPointFormulafrom another compatible formula.<T extends Formula>
TcastTo(FloatingPointFormula source, boolean signed, FormulaType<T> targetType) Build a formula of compatible type from aFloatingPointFormula.<T extends Formula>
TcastTo(FloatingPointFormula source, boolean signed, FormulaType<T> targetType, FloatingPointRoundingMode pFloatingPointRoundingMode) Build a formula of compatible type from aFloatingPointFormula.divide(FloatingPointFormula number1, FloatingPointFormula number2) divide(FloatingPointFormula number1, FloatingPointFormula number2, FloatingPointRoundingMode pFloatingPointRoundingMode) equalWithFPSemantics(FloatingPointFormula number1, FloatingPointFormula number2) Create a term for comparing the equality of two floating-point terms, according to standard floating-point semantics (i.e., NaN != NaN).fromIeeeBitvector(BitvectorFormula number, FormulaType.FloatingPointType pTargetType) Create a formula that interprets the given bitvector as a floating-point value in the IEEE format, according to the given type.greaterOrEquals(FloatingPointFormula number1, FloatingPointFormula number2) greaterThan(FloatingPointFormula number1, FloatingPointFormula number2) isInfinity(FloatingPointFormula number) isNaN(FloatingPointFormula number) isNegative(FloatingPointFormula number) checks whether a formula is negative, including -0.0.isNormal(FloatingPointFormula number) isSubnormal(FloatingPointFormula number) isZero(FloatingPointFormula number) lessOrEquals(FloatingPointFormula number1, FloatingPointFormula number2) lessThan(FloatingPointFormula number1, FloatingPointFormula number2) makeNumber(double n, FormulaType.FloatingPointType type) makeNumber(double n, FormulaType.FloatingPointType type, FloatingPointRoundingMode pFloatingPointRoundingMode) makeNumber(String n, FormulaType.FloatingPointType type, FloatingPointRoundingMode pFloatingPointRoundingMode) makeNumber(BigDecimal n, FormulaType.FloatingPointType type, FloatingPointRoundingMode pFloatingPointRoundingMode) makeNumber(Rational n, FormulaType.FloatingPointType type, FloatingPointRoundingMode pFloatingPointRoundingMode) makeVariable(String pVar, FormulaType.FloatingPointType type) Creates a variable with exactly the given name.max(FloatingPointFormula number1, FloatingPointFormula number2) min(FloatingPointFormula number1, FloatingPointFormula number2) multiply(FloatingPointFormula number1, FloatingPointFormula number2) multiply(FloatingPointFormula number1, FloatingPointFormula number2, FloatingPointRoundingMode pFloatingPointRoundingMode) negate(FloatingPointFormula number) round(FloatingPointFormula formula, FloatingPointRoundingMode roundingMode) sqrt(FloatingPointFormula number) sqrt(FloatingPointFormula number, FloatingPointRoundingMode roundingMode) subtract(FloatingPointFormula number1, FloatingPointFormula number2) subtract(FloatingPointFormula number1, FloatingPointFormula number2, FloatingPointRoundingMode pFloatingPointRoundingMode) toIeeeBitvector(FloatingPointFormula number) Create a formula that produces a representation of the given floating-point value as a bitvector conforming to the IEEE format.
-
Method Details
-
makeNumber
-
makeNumber
FloatingPointFormula makeNumber(double n, FormulaType.FloatingPointType type, FloatingPointRoundingMode pFloatingPointRoundingMode) -
makeNumber
-
makeNumber
FloatingPointFormula makeNumber(BigDecimal n, FormulaType.FloatingPointType type, FloatingPointRoundingMode pFloatingPointRoundingMode) -
makeNumber
-
makeNumber
FloatingPointFormula makeNumber(String n, FormulaType.FloatingPointType type, FloatingPointRoundingMode pFloatingPointRoundingMode) -
makeNumber
-
makeNumber
FloatingPointFormula makeNumber(Rational n, FormulaType.FloatingPointType type, FloatingPointRoundingMode pFloatingPointRoundingMode) -
makeVariable
Creates a variable with exactly the given name.Please 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. -
makePlusInfinity
-
makeMinusInfinity
-
makeNaN
-
castTo
<T extends Formula> T castTo(FloatingPointFormula source, boolean signed, FormulaType<T> targetType) Build a formula of compatible type from aFloatingPointFormula. This method uses the default rounding mode.Compatible formula types are all numeral types and (signed/unsigned) 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.
- Parameters:
source- the source formula of floating-point typesigned- if aBitvectorFormulais given as target, we additionally use this flag. Otherwise, we ignore it.targetType- the type of the resulting formula- Throws:
IllegalArgumentException- if an incompatible type is used, e.g. aFloatingPointFormulacannot be cast toBooleanFormula.
-
castTo
<T extends Formula> T castTo(FloatingPointFormula source, boolean signed, FormulaType<T> targetType, FloatingPointRoundingMode pFloatingPointRoundingMode) Build a formula of compatible type from aFloatingPointFormula.Compatible formula types are all numeral types and (signed/unsigned) 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.
- Parameters:
source- the source formula of floating-point typesigned- if aBitvectorFormulais given as target, 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.- Throws:
IllegalArgumentException- if an incompatible type is used, e.g. aFloatingPointFormulacannot be cast toBooleanFormula.
-
castFrom
FloatingPointFormula castFrom(Formula source, boolean signed, FormulaType.FloatingPointType targetType) Build aFloatingPointFormulafrom another compatible formula. This method uses the default rounding mode.Compatible formula types are all numeral types and (signed/unsigned) 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.
- Parameters:
source- the source formula of compatible typesigned- if aBitvectorFormulais given as source, we additionally use this flag. Otherwise, we ignore it.targetType- the type of the resulting formula- Throws:
IllegalArgumentException- if an incompatible type is used, e.g. aBooleanFormulacannot be cast toFloatingPointFormula.
-
castFrom
FloatingPointFormula castFrom(Formula source, boolean signed, FormulaType.FloatingPointType targetType, FloatingPointRoundingMode pFloatingPointRoundingMode) Build aFloatingPointFormulafrom another compatible formula.Compatible formula types are all numeral types and (signed/unsigned) 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.
- Parameters:
source- the source formula of compatible typesigned- if aBitvectorFormulais 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.- Throws:
IllegalArgumentException- if an incompatible type is used, e.g. aBooleanFormulacannot be cast toFloatingPointFormula.
-
fromIeeeBitvector
FloatingPointFormula fromIeeeBitvector(BitvectorFormula number, FormulaType.FloatingPointType pTargetType) Create a formula that interprets the given bitvector as a floating-point value in the IEEE format, according to the given type. The sum of the sizes of exponent and mantissa of the target type plus 1 (for the sign bit) needs to be equal to the size of the bitvector.Note: This method will return a value that is (numerically) far away from the original value. This method is completely different from
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. -
toIeeeBitvector
Create a formula that produces a representation of the given floating-point value as a bitvector conforming to the IEEE format. The size of the resulting bitvector is the sum of the sizes of the exponent and mantissa of the input formula plus 1 (for the sign bit). -
round
-
negate
-
abs
-
max
-
min
-
sqrt
-
sqrt
-
add
-
add
FloatingPointFormula add(FloatingPointFormula number1, FloatingPointFormula number2, FloatingPointRoundingMode pFloatingPointRoundingMode) -
subtract
-
subtract
FloatingPointFormula subtract(FloatingPointFormula number1, FloatingPointFormula number2, FloatingPointRoundingMode pFloatingPointRoundingMode) -
divide
-
divide
FloatingPointFormula divide(FloatingPointFormula number1, FloatingPointFormula number2, FloatingPointRoundingMode pFloatingPointRoundingMode) -
multiply
-
multiply
FloatingPointFormula multiply(FloatingPointFormula number1, FloatingPointFormula number2, FloatingPointRoundingMode pFloatingPointRoundingMode) -
assignment
Create a term for assigning one floating-point term to another. This means both terms are considered equal afterwards. This method is the same as the methodequalfor other theories. -
equalWithFPSemantics
Create a term for comparing the equality of two floating-point terms, according to standard floating-point semantics (i.e., NaN != NaN). Be careful to not use this method when you really needassignment(FloatingPointFormula, FloatingPointFormula). -
greaterThan
-
greaterOrEquals
-
lessThan
-
lessOrEquals
-
isNaN
-
isInfinity
-
isZero
-
isNormal
-
isSubnormal
-
isNegative
checks whether a formula is negative, including -0.0.
-