Skip to content

Commit

Permalink
change name of utility variable and document it.
Browse files Browse the repository at this point in the history
  • Loading branch information
kfriedberger committed Sep 22, 2024
1 parent d00c4c2 commit 467459e
Showing 1 changed file with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,6 @@ protected Term fromIeeeBitvectorImpl(Term pNumber, FloatingPointType pTargetType
pTargetType.getMantissaSize() + 1);
}

private String newVariable() {
return "__CAST_FROM_BV_" + counter++;
}

@Override
protected Term toIeeeBitvectorImpl(Term pNumber) {
int sizeExp = pNumber.sort().fp_exp_size();
Expand All @@ -225,11 +221,13 @@ protected Term toIeeeBitvectorImpl(Term pNumber) {
// Note that NaN is handled as a special case in this method. This is not strictly necessary,
// but if we just use "fpTerm = to_fp(bvVar)" the NaN will be given a random payload (and
// sign). Since NaN payloads are not preserved here anyway we might as well pick a canonical
// representation.
Term bvNaN =
termManager.mk_bv_value(bvSort, "0" + "1".repeat(sizeExp + 1) + "0".repeat(sizeSig - 2));
// representation, e.g., which is "0 11111111 10000000000000000000000" for single precision.
String nanRepr = "0" + "1".repeat(sizeExp + 1) + "0".repeat(sizeSig - 2);
Term bvNaN = termManager.mk_bv_value(bvSort, nanRepr);

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

0 comments on commit 467459e

Please sign in to comment.