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)
 
 kind (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
 
 ast
 
- 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 9660 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 9706 of file z3py.py.

9706 def __add__(self, other):
9707 """Create the Z3 expression `self + other`.
9708
9709 >>> x = FP('x', FPSort(8, 24))
9710 >>> y = FP('y', FPSort(8, 24))
9711 >>> x + y
9712 x + y
9713 >>> (x + y).sort()
9714 FPSort(8, 24)
9715 """
9716 [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
9717 return fpAdd(_dflt_rm(), a, b, self.ctx)
9718

◆ __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 9793 of file z3py.py.

9793 def __div__(self, other):
9794 """Create the Z3 expression `self / other`.
9795
9796 >>> x = FP('x', FPSort(8, 24))
9797 >>> y = FP('y', FPSort(8, 24))
9798 >>> x / y
9799 x / y
9800 >>> (x / y).sort()
9801 FPSort(8, 24)
9802 >>> 10 / y
9803 1.25*(2**3) / y
9804 """
9805 [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
9806 return fpDiv(_dflt_rm(), a, b, self.ctx)
9807

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

◆ __ge__()

__ge__ ( self,
other )

Definition at line 9700 of file z3py.py.

9700 def __ge__(self, other):
9701 return fpGEQ(self, other, self.ctx)
9702

◆ __gt__()

__gt__ ( self,
other )

Definition at line 9703 of file z3py.py.

9703 def __gt__(self, other):
9704 return fpGT(self, other, self.ctx)
9705

◆ __le__()

__le__ ( self,
other )

Definition at line 9694 of file z3py.py.

9694 def __le__(self, other):
9695 return fpLEQ(self, other, self.ctx)
9696

◆ __lt__()

__lt__ ( self,
other )

Definition at line 9697 of file z3py.py.

9697 def __lt__(self, other):
9698 return fpLT(self, other, self.ctx)
9699

◆ __mod__()

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

Definition at line 9829 of file z3py.py.

9829 def __mod__(self, other):
9830 """Create the Z3 expression mod `self % other`."""
9831 return fpRem(self, other)
9832

◆ __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 9752 of file z3py.py.

9752 def __mul__(self, other):
9753 """Create the Z3 expression `self * other`.
9754
9755 >>> x = FP('x', FPSort(8, 24))
9756 >>> y = FP('y', FPSort(8, 24))
9757 >>> x * y
9758 x * y
9759 >>> (x * y).sort()
9760 FPSort(8, 24)
9761 >>> 10 * y
9762 1.25*(2**3) * y
9763 """
9764 [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
9765 return fpMul(_dflt_rm(), a, b, self.ctx)
9766

◆ __neg__()

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

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

Definition at line 9784 of file z3py.py.

9784 def __neg__(self):
9785 """Create the Z3 expression `-self`.
9786
9787 >>> x = FP('x', Float32())
9788 >>> -x
9789 -x
9790 """
9791 return fpNeg(self)
9792

◆ __pos__()

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

Definition at line 9780 of file z3py.py.

9780 def __pos__(self):
9781 """Create the Z3 expression `+self`."""
9782 return self
9783

◆ __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 9719 of file z3py.py.

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

◆ __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 9808 of file z3py.py.

9808 def __rdiv__(self, other):
9809 """Create the Z3 expression `other / self`.
9810
9811 >>> x = FP('x', FPSort(8, 24))
9812 >>> y = FP('y', FPSort(8, 24))
9813 >>> x / y
9814 x / y
9815 >>> x / 10
9816 x / 1.25*(2**3)
9817 """
9818 [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
9819 return fpDiv(_dflt_rm(), a, b, self.ctx)
9820

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

◆ __rmod__()

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

Definition at line 9833 of file z3py.py.

9833 def __rmod__(self, other):
9834 """Create the Z3 expression mod `other % self`."""
9835 return fpRem(other, self)
9836
9837

◆ __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 9767 of file z3py.py.

9767 def __rmul__(self, other):
9768 """Create the Z3 expression `other * self`.
9769
9770 >>> x = FP('x', FPSort(8, 24))
9771 >>> y = FP('y', FPSort(8, 24))
9772 >>> x * y
9773 x * y
9774 >>> x * 10
9775 x * 1.25*(2**3)
9776 """
9777 [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
9778 return fpMul(_dflt_rm(), a, b, self.ctx)
9779

◆ __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 9742 of file z3py.py.

9742 def __rsub__(self, other):
9743 """Create the Z3 expression `other - self`.
9744
9745 >>> x = FP('x', FPSort(8, 24))
9746 >>> 10 - x
9747 1.25*(2**3) - x
9748 """
9749 [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
9750 return fpSub(_dflt_rm(), a, b, self.ctx)
9751

◆ __rtruediv__()

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

Definition at line 9825 of file z3py.py.

9825 def __rtruediv__(self, other):
9826 """Create the Z3 expression division `other / self`."""
9827 return self.__rdiv__(other)
9828

◆ __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 9729 of file z3py.py.

9729 def __sub__(self, other):
9730 """Create the Z3 expression `self - other`.
9731
9732 >>> x = FP('x', FPSort(8, 24))
9733 >>> y = FP('y', FPSort(8, 24))
9734 >>> x - y
9735 x - y
9736 >>> (x - y).sort()
9737 FPSort(8, 24)
9738 """
9739 [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
9740 return fpSub(_dflt_rm(), a, b, self.ctx)
9741

◆ __truediv__()

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

Definition at line 9821 of file z3py.py.

9821 def __truediv__(self, other):
9822 """Create the Z3 expression division `self / other`."""
9823 return self.__div__(other)
9824

◆ as_string()

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

Reimplemented in FPNumRef.

Definition at line 9690 of file z3py.py.

9690 def as_string(self):
9691 """Return a Z3 floating point expression as a Python string."""
9692 return Z3_ast_to_string(self.ctx_ref(), self.as_ast())
9693
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 9674 of file z3py.py.

9674 def ebits(self):
9675 """Retrieves the number of bits reserved for the exponent in the FloatingPoint expression `self`.
9676 >>> b = FPSort(8, 24)
9677 >>> b.ebits()
9678 8
9679 """
9680 return self.sort().ebits()
9681

◆ 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 9682 of file z3py.py.

9682 def sbits(self):
9683 """Retrieves the number of bits reserved for the exponent in the FloatingPoint expression `self`.
9684 >>> b = FPSort(8, 24)
9685 >>> b.sbits()
9686 24
9687 """
9688 return self.sort().sbits()
9689

◆ 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 9663 of file z3py.py.

9663 def sort(self):
9664 """Return the sort of the floating-point expression `self`.
9665
9666 >>> x = FP('1.0', FPSort(8, 24))
9667 >>> x.sort()
9668 FPSort(8, 24)
9669 >>> x.sort() == FPSort(8, 24)
9670 True
9671 """
9672 return FPSortRef(Z3_get_sort(self.ctx_ref(), self.as_ast()), self.ctx)
9673
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 9672 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(), ModelRef.project(), ModelRef.project_with_witness(), 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().