diff --git a/src/api/python/z3/z3.py b/src/api/python/z3/z3.py index 4ee5883ed..7e58a724c 100644 --- a/src/api/python/z3/z3.py +++ b/src/api/python/z3/z3.py @@ -6712,6 +6712,8 @@ class Optimize(Z3PPObject): """ if _is_int(weight): weight = "%d" % weight + elif isinstance(weight, (float, double)): + weight = "%f" % weight if not isinstance(weight, str): raise Z3Exception("weight should be a string or an integer") if id is None: