Skip to content

Commit 467459e

Browse files
committed
change name of utility variable and document it.
1 parent d00c4c2 commit 467459e

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/org/sosy_lab/java_smt/solvers/bitwuzla/BitwuzlaFloatingPointManager.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -201,10 +201,6 @@ protected Term fromIeeeBitvectorImpl(Term pNumber, FloatingPointType pTargetType
201201
pTargetType.getMantissaSize() + 1);
202202
}
203203

204-
private String newVariable() {
205-
return "__CAST_FROM_BV_" + counter++;
206-
}
207-
208204
@Override
209205
protected Term toIeeeBitvectorImpl(Term pNumber) {
210206
int sizeExp = pNumber.sort().fp_exp_size();
@@ -225,11 +221,13 @@ protected Term toIeeeBitvectorImpl(Term pNumber) {
225221
// Note that NaN is handled as a special case in this method. This is not strictly necessary,
226222
// but if we just use "fpTerm = to_fp(bvVar)" the NaN will be given a random payload (and
227223
// sign). Since NaN payloads are not preserved here anyway we might as well pick a canonical
228-
// representation.
229-
Term bvNaN =
230-
termManager.mk_bv_value(bvSort, "0" + "1".repeat(sizeExp + 1) + "0".repeat(sizeSig - 2));
224+
// representation, e.g., which is "0 11111111 10000000000000000000000" for single precision.
225+
String nanRepr = "0" + "1".repeat(sizeExp + 1) + "0".repeat(sizeSig - 2);
226+
Term bvNaN = termManager.mk_bv_value(bvSort, nanRepr);
231227

232-
String newVariable = newVariable();
228+
// TODO creating our own utility variables might eb unexpected from the user.
229+
// We might need to exclude such variables in models and formula traversal.
230+
String newVariable = "__JAVASMT__CAST_FROM_BV_" + counter++;
233231
Term bvVar = termManager.mk_const(bvSort, newVariable);
234232
Term equal =
235233
termManager.mk_term(

0 commit comments

Comments
 (0)