Skip to content

Commit

Permalink
fix #7501
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolajBjorner committed Jan 5, 2025
1 parent f6e3c5a commit cd41b21
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/api/python/z3/z3.py
Original file line number Diff line number Diff line change
Expand Up @@ -3437,9 +3437,11 @@ def ToReal(a):
>>> n.sort()
Real
"""
ctx = a.ctx
if isinstance(a, BoolRef):
return If(a, RealVal(1, ctx), RealVal(0, ctx))
if z3_debug():
_z3_assert(a.is_int(), "Z3 integer expression expected.")
ctx = a.ctx
return ArithRef(Z3_mk_int2real(ctx.ref(), a.as_ast()), ctx)


Expand Down

0 comments on commit cd41b21

Please sign in to comment.