Z3
 
Loading...
Searching...
No Matches
FPRef Class Reference
+ Inheritance diagram for FPRef:

Public Member Functions

 sort (self)
 
 ebits (self)
 
 sbits (self)
 
 as_string (self)
 
 __le__ (self, other)
 
 __lt__ (self, other)
 
 __ge__ (self, other)
 
 __gt__ (self, other)
 
 __add__ (self, other)
 
 __radd__ (self, other)
 
 __sub__ (self, other)
 
 __rsub__ (self, other)
 
 __mul__ (self, other)
 
 __rmul__ (self, other)
 
 __pos__ (self)
 
 __neg__ (self)
 
 __div__ (self, other)
 
 __rdiv__ (self, other)
 
 __truediv__ (self, other)
 
 __rtruediv__ (self, other)
 
 __mod__ (self, other)
 
 __rmod__ (self, other)
 
- Public Member Functions inherited from ExprRef
 as_ast (self)
 
 get_id (self)
 
 sort_kind (self)
 
 __eq__ (self, other)
 
 __hash__ (self)
 
 __ne__ (self, other)
 
 params (self)
 
 decl (self)
 
 num_args (self)
 
 arg (self, idx)
 
 children (self)
 
 from_string (self, s)
 
 serialize (self)
 
- Public Member Functions inherited from AstRef
 __init__ (self, ast, ctx=None)
 
 __del__ (self)
 
 __deepcopy__ (self, memo={})
 
 __str__ (self)
 
 __repr__ (self)
 
 __nonzero__ (self)
 
 __bool__ (self)
 
 sexpr (self)
 
 ctx_ref (self)
 
 eq (self, other)
 
 translate (self, target)
 
 __copy__ (self)
 
 hash (self)
 
- Public Member Functions inherited from Z3PPObject
 use_pp (self)
 

Data Fields

 ctx = _coerce_fp_expr_list([other, self], self.ctx)
 
- Data Fields inherited from ExprRef
 ctx
 
- Data Fields inherited from AstRef
 ast = ast
 
 ctx = _get_ctx(ctx)
 

Additional Inherited Members

- Protected Member Functions inherited from Z3PPObject
 _repr_html_ (self)
 

Detailed Description

Floating-point expressions.

Definition at line 9613 of file z3py.py.

Member Function Documentation

◆ __add__()

__add__ ( self,
other )
Create the Z3 expression `self + other`.

>>> x = FP('x', FPSort(8, 24))
>>> y = FP('y', FPSort(8, 24))
>>> x + y
x + y
>>> (x + y).sort()
FPSort(8, 24)

Definition at line 9659 of file z3py.py.

9659 def __add__(self, other):
9660 """Create the Z3 expression `self + other`.
9661
9662 >>> x = FP('x', FPSort(8, 24))
9663 >>> y = FP('y', FPSort(8, 24))
9664 >>> x + y
9665 x + y
9666 >>> (x + y).sort()
9667 FPSort(8, 24)
9668 """
9669 [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
9670 return fpAdd(_dflt_rm(), a, b, self.ctx)
9671

◆ __div__()

__div__ ( self,
other )
Create the Z3 expression `self / other`.

>>> x = FP('x', FPSort(8, 24))
>>> y = FP('y', FPSort(8, 24))
>>> x / y
x / y
>>> (x / y).sort()
FPSort(8, 24)
>>> 10 / y
1.25*(2**3) / y

Definition at line 9746 of file z3py.py.

9746 def __div__(self, other):
9747 """Create the Z3 expression `self / other`.
9748
9749 >>> x = FP('x', FPSort(8, 24))
9750 >>> y = FP('y', FPSort(8, 24))
9751 >>> x / y
9752 x / y
9753 >>> (x / y).sort()
9754 FPSort(8, 24)
9755 >>> 10 / y
9756 1.25*(2**3) / y
9757 """
9758 [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
9759 return fpDiv(_dflt_rm(), a, b, self.ctx)
9760

Referenced by ArithRef.__truediv__(), and BitVecRef.__truediv__().

◆ __ge__()

__ge__ ( self,
other )

Definition at line 9653 of file z3py.py.

9653 def __ge__(self, other):
9654 return fpGEQ(self, other, self.ctx)
9655

◆ __gt__()

__gt__ ( self,
other )

Definition at line 9656 of file z3py.py.

9656 def __gt__(self, other):
9657 return fpGT(self, other, self.ctx)
9658

◆ __le__()

__le__ ( self,
other )

Definition at line 9647 of file z3py.py.

9647 def __le__(self, other):
9648 return fpLEQ(self, other, self.ctx)
9649

◆ __lt__()

__lt__ ( self,
other )

Definition at line 9650 of file z3py.py.

9650 def __lt__(self, other):
9651 return fpLT(self, other, self.ctx)
9652

◆ __mod__()

__mod__ ( self,
other )
Create the Z3 expression mod `self % other`.

Definition at line 9782 of file z3py.py.

9782 def __mod__(self, other):
9783 """Create the Z3 expression mod `self % other`."""
9784 return fpRem(self, other)
9785

◆ __mul__()

__mul__ ( self,
other )
Create the Z3 expression `self * other`.

>>> x = FP('x', FPSort(8, 24))
>>> y = FP('y', FPSort(8, 24))
>>> x * y
x * y
>>> (x * y).sort()
FPSort(8, 24)
>>> 10 * y
1.25*(2**3) * y

Definition at line 9705 of file z3py.py.

9705 def __mul__(self, other):
9706 """Create the Z3 expression `self * other`.
9707
9708 >>> x = FP('x', FPSort(8, 24))
9709 >>> y = FP('y', FPSort(8, 24))
9710 >>> x * y
9711 x * y
9712 >>> (x * y).sort()
9713 FPSort(8, 24)
9714 >>> 10 * y
9715 1.25*(2**3) * y
9716 """
9717 [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
9718 return fpMul(_dflt_rm(), a, b, self.ctx)
9719

◆ __neg__()

__neg__ ( self)
Create the Z3 expression `-self`.

>>> x = FP('x', Float32())
>>> -x
-x

Definition at line 9737 of file z3py.py.

9737 def __neg__(self):
9738 """Create the Z3 expression `-self`.
9739
9740 >>> x = FP('x', Float32())
9741 >>> -x
9742 -x
9743 """
9744 return fpNeg(self)
9745

◆ __pos__()

__pos__ ( self)
Create the Z3 expression `+self`.

Definition at line 9733 of file z3py.py.

9733 def __pos__(self):
9734 """Create the Z3 expression `+self`."""
9735 return self
9736

◆ __radd__()

__radd__ ( self,
other )
Create the Z3 expression `other + self`.

>>> x = FP('x', FPSort(8, 24))
>>> 10 + x
1.25*(2**3) + x

Definition at line 9672 of file z3py.py.

9672 def __radd__(self, other):
9673 """Create the Z3 expression `other + self`.
9674
9675 >>> x = FP('x', FPSort(8, 24))
9676 >>> 10 + x
9677 1.25*(2**3) + x
9678 """
9679 [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
9680 return fpAdd(_dflt_rm(), a, b, self.ctx)
9681

◆ __rdiv__()

__rdiv__ ( self,
other )
Create the Z3 expression `other / self`.

>>> x = FP('x', FPSort(8, 24))
>>> y = FP('y', FPSort(8, 24))
>>> x / y
x / y
>>> x / 10
x / 1.25*(2**3)

Definition at line 9761 of file z3py.py.

9761 def __rdiv__(self, other):
9762 """Create the Z3 expression `other / self`.
9763
9764 >>> x = FP('x', FPSort(8, 24))
9765 >>> y = FP('y', FPSort(8, 24))
9766 >>> x / y
9767 x / y
9768 >>> x / 10
9769 x / 1.25*(2**3)
9770 """
9771 [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
9772 return fpDiv(_dflt_rm(), a, b, self.ctx)
9773

Referenced by ArithRef.__rtruediv__(), and BitVecRef.__rtruediv__().

◆ __rmod__()

__rmod__ ( self,
other )
Create the Z3 expression mod `other % self`.

Definition at line 9786 of file z3py.py.

9786 def __rmod__(self, other):
9787 """Create the Z3 expression mod `other % self`."""
9788 return fpRem(other, self)
9789
9790

◆ __rmul__()

__rmul__ ( self,
other )
Create the Z3 expression `other * self`.

>>> x = FP('x', FPSort(8, 24))
>>> y = FP('y', FPSort(8, 24))
>>> x * y
x * y
>>> x * 10
x * 1.25*(2**3)

Definition at line 9720 of file z3py.py.

9720 def __rmul__(self, other):
9721 """Create the Z3 expression `other * self`.
9722
9723 >>> x = FP('x', FPSort(8, 24))
9724 >>> y = FP('y', FPSort(8, 24))
9725 >>> x * y
9726 x * y
9727 >>> x * 10
9728 x * 1.25*(2**3)
9729 """
9730 [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
9731 return fpMul(_dflt_rm(), a, b, self.ctx)
9732

◆ __rsub__()

__rsub__ ( self,
other )
Create the Z3 expression `other - self`.

>>> x = FP('x', FPSort(8, 24))
>>> 10 - x
1.25*(2**3) - x

Definition at line 9695 of file z3py.py.

9695 def __rsub__(self, other):
9696 """Create the Z3 expression `other - self`.
9697
9698 >>> x = FP('x', FPSort(8, 24))
9699 >>> 10 - x
9700 1.25*(2**3) - x
9701 """
9702 [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
9703 return fpSub(_dflt_rm(), a, b, self.ctx)
9704

◆ __rtruediv__()

__rtruediv__ ( self,
other )
Create the Z3 expression division `other / self`.

Definition at line 9778 of file z3py.py.

9778 def __rtruediv__(self, other):
9779 """Create the Z3 expression division `other / self`."""
9780 return self.__rdiv__(other)
9781

◆ __sub__()

__sub__ ( self,
other )
Create the Z3 expression `self - other`.

>>> x = FP('x', FPSort(8, 24))
>>> y = FP('y', FPSort(8, 24))
>>> x - y
x - y
>>> (x - y).sort()
FPSort(8, 24)

Definition at line 9682 of file z3py.py.

9682 def __sub__(self, other):
9683 """Create the Z3 expression `self - other`.
9684
9685 >>> x = FP('x', FPSort(8, 24))
9686 >>> y = FP('y', FPSort(8, 24))
9687 >>> x - y
9688 x - y
9689 >>> (x - y).sort()
9690 FPSort(8, 24)
9691 """
9692 [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
9693 return fpSub(_dflt_rm(), a, b, self.ctx)
9694

◆ __truediv__()

__truediv__ ( self,
other )
Create the Z3 expression division `self / other`.

Definition at line 9774 of file z3py.py.

9774 def __truediv__(self, other):
9775 """Create the Z3 expression division `self / other`."""
9776 return self.__div__(other)
9777

◆ as_string()

as_string ( self)
Return a Z3 floating point expression as a Python string.

Reimplemented in FPNumRef.

Definition at line 9643 of file z3py.py.

9643 def as_string(self):
9644 """Return a Z3 floating point expression as a Python string."""
9645 return Z3_ast_to_string(self.ctx_ref(), self.as_ast())
9646
Z3_string Z3_API Z3_ast_to_string(Z3_context c, Z3_ast a)
Convert the given AST node into a string.

Referenced by BitVecNumRef.as_long(), and IntNumRef.as_long().

◆ ebits()

ebits ( self)
Retrieves the number of bits reserved for the exponent in the FloatingPoint expression `self`.
>>> b = FPSort(8, 24)
>>> b.ebits()
8

Definition at line 9627 of file z3py.py.

9627 def ebits(self):
9628 """Retrieves the number of bits reserved for the exponent in the FloatingPoint expression `self`.
9629 >>> b = FPSort(8, 24)
9630 >>> b.ebits()
9631 8
9632 """
9633 return self.sort().ebits()
9634

◆ sbits()

sbits ( self)
Retrieves the number of bits reserved for the exponent in the FloatingPoint expression `self`.
>>> b = FPSort(8, 24)
>>> b.sbits()
24

Definition at line 9635 of file z3py.py.

9635 def sbits(self):
9636 """Retrieves the number of bits reserved for the exponent in the FloatingPoint expression `self`.
9637 >>> b = FPSort(8, 24)
9638 >>> b.sbits()
9639 24
9640 """
9641 return self.sort().sbits()
9642

◆ sort()

sort ( self)
Return the sort of the floating-point expression `self`.

>>> x = FP('1.0', FPSort(8, 24))
>>> x.sort()
FPSort(8, 24)
>>> x.sort() == FPSort(8, 24)
True

Reimplemented from ExprRef.

Definition at line 9616 of file z3py.py.

9616 def sort(self):
9617 """Return the sort of the floating-point expression `self`.
9618
9619 >>> x = FP('1.0', FPSort(8, 24))
9620 >>> x.sort()
9621 FPSort(8, 24)
9622 >>> x.sort() == FPSort(8, 24)
9623 True
9624 """
9625 return FPSortRef(Z3_get_sort(self.ctx_ref(), self.as_ast()), self.ctx)
9626
Z3_sort Z3_API Z3_get_sort(Z3_context c, Z3_ast a)
Return the sort of an AST node.

Referenced by ArrayRef.domain(), ArrayRef.domain_n(), ArithRef.is_int(), ArithRef.is_real(), ArrayRef.range(), BitVecRef.size(), and ExprRef.sort_kind().

Field Documentation

◆ ctx

ctx = _coerce_fp_expr_list([other, self], self.ctx)

Definition at line 9625 of file z3py.py.

Referenced by ArithRef.__add__(), BitVecRef.__add__(), BitVecRef.__and__(), FuncDeclRef.__call__(), AstMap.__contains__(), AstRef.__copy__(), AstVector.__copy__(), FuncInterp.__copy__(), Goal.__copy__(), ModelRef.__copy__(), AstMap.__deepcopy__(), AstRef.__deepcopy__(), AstVector.__deepcopy__(), Datatype.__deepcopy__(), FuncEntry.__deepcopy__(), FuncInterp.__deepcopy__(), Goal.__deepcopy__(), ModelRef.__deepcopy__(), ParamDescrsRef.__deepcopy__(), ParamsRef.__deepcopy__(), Statistics.__deepcopy__(), AstMap.__del__(), AstRef.__del__(), AstVector.__del__(), Context.__del__(), FuncEntry.__del__(), FuncInterp.__del__(), Goal.__del__(), ModelRef.__del__(), ParamDescrsRef.__del__(), ParamsRef.__del__(), ScopedConstructor.__del__(), ScopedConstructorList.__del__(), Solver.__del__(), Statistics.__del__(), ArithRef.__div__(), BitVecRef.__div__(), ExprRef.__eq__(), ArithRef.__ge__(), BitVecRef.__ge__(), AstMap.__getitem__(), AstVector.__getitem__(), ModelRef.__getitem__(), Statistics.__getitem__(), ArithRef.__gt__(), BitVecRef.__gt__(), BitVecRef.__invert__(), ArithRef.__le__(), BitVecRef.__le__(), AstMap.__len__(), AstVector.__len__(), ModelRef.__len__(), Statistics.__len__(), BitVecRef.__lshift__(), ArithRef.__lt__(), BitVecRef.__lt__(), ArithRef.__mod__(), BitVecRef.__mod__(), ArithRef.__mul__(), BitVecRef.__mul__(), BoolRef.__mul__(), ExprRef.__ne__(), ArithRef.__neg__(), BitVecRef.__neg__(), BitVecRef.__or__(), ArithRef.__pow__(), ArithRef.__radd__(), BitVecRef.__radd__(), BitVecRef.__rand__(), ArithRef.__rdiv__(), BitVecRef.__rdiv__(), AstMap.__repr__(), ParamDescrsRef.__repr__(), ParamsRef.__repr__(), Statistics.__repr__(), BitVecRef.__rlshift__(), ArithRef.__rmod__(), BitVecRef.__rmod__(), ArithRef.__rmul__(), BitVecRef.__rmul__(), BitVecRef.__ror__(), ArithRef.__rpow__(), BitVecRef.__rrshift__(), BitVecRef.__rshift__(), ArithRef.__rsub__(), BitVecRef.__rsub__(), BitVecRef.__rxor__(), AstMap.__setitem__(), AstVector.__setitem__(), ArithRef.__sub__(), BitVecRef.__sub__(), BitVecRef.__xor__(), DatatypeSortRef.accessor(), ExprRef.arg(), FuncEntry.arg_value(), FuncInterp.arity(), Goal.as_expr(), Solver.assert_and_track(), Goal.assert_exprs(), Solver.assert_exprs(), QuantifierRef.body(), Solver.check(), Goal.convert_model(), AstRef.ctx_ref(), ExprRef.decl(), ModelRef.decls(), ArrayRef.default(), RatNumRef.denominator(), Goal.depth(), Goal.dimacs(), FuncDeclRef.domain(), ArraySortRef.domain_n(), FuncInterp.else_value(), FuncInterp.entry(), AstMap.erase(), ModelRef.eval(), Goal.get(), ParamDescrsRef.get_documentation(), ModelRef.get_interp(), Statistics.get_key_value(), ParamDescrsRef.get_kind(), ParamDescrsRef.get_name(), ModelRef.get_sort(), ModelRef.get_universe(), Goal.inconsistent(), AstMap.keys(), Statistics.keys(), Solver.model(), SortRef.name(), QuantifierRef.no_pattern(), FuncEntry.num_args(), FuncInterp.num_entries(), Solver.num_scopes(), ModelRef.num_sorts(), FuncDeclRef.params(), QuantifierRef.pattern(), AlgebraicNumRef.poly(), Solver.pop(), Goal.prec(), AstVector.push(), Solver.push(), QuantifierRef.qid(), ArraySortRef.range(), FuncDeclRef.range(), DatatypeSortRef.recognizer(), Context.ref(), AstMap.reset(), Solver.reset(), AstVector.resize(), ParamsRef.set(), Solver.set(), AstVector.sexpr(), Goal.sexpr(), ModelRef.sexpr(), Goal.size(), ParamDescrsRef.size(), QuantifierRef.skolem_id(), AstRef.translate(), AstVector.translate(), Goal.translate(), ModelRef.translate(), ParamsRef.validate(), FuncEntry.value(), QuantifierRef.var_name(), and QuantifierRef.var_sort().