Skip to content

Commit

Permalink
add custom coercion for floats. fix #6482
Browse files Browse the repository at this point in the history
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
  • Loading branch information
NikolajBjorner committed Dec 7, 2022
1 parent c45c40e commit 4a451b1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/api/python/z3/z3.py
Original file line number Diff line number Diff line change
Expand Up @@ -1194,7 +1194,7 @@ def _coerce_expr_merge(s, a):
else:
if z3_debug():
_z3_assert(s1.ctx == s.ctx, "context mismatch")
_z3_assert(False, "sort mismatch")
_z3_assert(False, "sort mismatch")
else:
return s

Expand All @@ -1207,6 +1207,11 @@ def _coerce_exprs(a, b, ctx=None):
a = StringVal(a, b.ctx)
if isinstance(b, str) and isinstance(a, SeqRef):
b = StringVal(b, a.ctx)
if isinstance(a, float) and isinstance(b, ArithRef):
a = RealVal(a, b.ctx)
if isinstance(b, float) and isinstance(a, ArithRef):
b = RealVal(b, a.ctx)

s = None
s = _coerce_expr_merge(s, a)
s = _coerce_expr_merge(s, b)
Expand Down

0 comments on commit 4a451b1

Please sign in to comment.