Skip to content

Commit 58c9f4e

Browse files
committed
FP-FormulaManager: re-add deprecated methods that were removed in 48ca57a.
We provide a default implementation that forwards to the better implementation of the method.
1 parent 457e178 commit 58c9f4e

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

src/org/sosy_lab/java_smt/api/FloatingPointFormulaManager.java

+45
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,51 @@ FloatingPointFormula makeNumber(
146146

147147
FloatingPointFormula makeNaN(FloatingPointType type);
148148

149+
/**
150+
* Build a formula of compatible type from a {@link FloatingPointFormula}. This method uses the
151+
* default rounding mode.
152+
*
153+
* <p>Compatible formula types are all numeral types and bitvector types. It is also possible to
154+
* cast a floating-point number into another floating-point type. We do not support casting from
155+
* boolean or array types. We try to keep an exact representation, however fall back to rounding
156+
* if needed.
157+
*
158+
* @param source the source formula of floating-point type
159+
* @param targetType the type of the resulting formula
160+
* @throws IllegalArgumentException if an incompatible type is used, e.g. a {@link
161+
* FloatingPointFormula} cannot be cast to {@link BooleanFormula}.
162+
*/
163+
@Deprecated(
164+
forRemoval = true,
165+
since = "2022.06, because of missing sign-bit for bitvector conversion")
166+
default <T extends Formula> T castTo(FloatingPointFormula source, FormulaType<T> targetType) {
167+
return castTo(source, true, targetType);
168+
}
169+
170+
/**
171+
* Build a formula of compatible type from a {@link FloatingPointFormula}.
172+
*
173+
* <p>Compatible formula types are all numeral types and bitvector types. It is also possible to
174+
* cast a floating-point number into another floating-point type. We do not support casting from
175+
* boolean or array types. We try to keep an exact representation, however fall back to rounding
176+
* if needed.
177+
*
178+
* @param source the source formula of floating-point type
179+
* @param targetType the type of the resulting formula
180+
* @param pFloatingPointRoundingMode if rounding is needed, we apply the rounding mode.
181+
* @throws IllegalArgumentException if an incompatible type is used, e.g. a {@link
182+
* FloatingPointFormula} cannot be cast to {@link BooleanFormula}.
183+
*/
184+
@Deprecated(
185+
forRemoval = true,
186+
since = "2022.06, because of missing sign-bit for bitvector conversion")
187+
default <T extends Formula> T castTo(
188+
FloatingPointFormula source,
189+
FormulaType<T> targetType,
190+
FloatingPointRoundingMode pFloatingPointRoundingMode) {
191+
return castTo(source, true, targetType, pFloatingPointRoundingMode);
192+
}
193+
149194
/**
150195
* Build a formula of compatible type from a {@link FloatingPointFormula}. This method uses the
151196
* default rounding mode.

0 commit comments

Comments
 (0)