Z3
 
Loading...
Searching...
No Matches
Public Member Functions | Data Fields
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)
 
 update (self, *args)
 
 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)
 
 py_value (self)
 
- Public Member Functions inherited from Z3PPObject
 use_pp (self)
 

Data Fields

 ctx
 
- Data Fields inherited from ExprRef
 ctx
 
 ast
 
- Data Fields inherited from AstRef
 ast
 
 ctx
 

Additional Inherited Members

- Protected Member Functions inherited from Z3PPObject
 _repr_html_ (self)
 

Detailed Description

Floating-point expressions.

Definition at line 9883 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 9929 of file z3py.py.

9929 def __add__(self, other):
9930 """Create the Z3 expression `self + other`.
9931
9932 >>> x = FP('x', FPSort(8, 24))
9933 >>> y = FP('y', FPSort(8, 24))
9934 >>> x + y
9935 x + y
9936 >>> (x + y).sort()
9937 FPSort(8, 24)
9938 """
9939 [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
9940 return fpAdd(_dflt_rm(), a, b, self.ctx)
9941

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

10016 def __div__(self, other):
10017 """Create the Z3 expression `self / other`.
10018
10019 >>> x = FP('x', FPSort(8, 24))
10020 >>> y = FP('y', FPSort(8, 24))
10021 >>> x / y
10022 x / y
10023 >>> (x / y).sort()
10024 FPSort(8, 24)
10025 >>> 10 / y
10026 1.25*(2**3) / y
10027 """
10028 [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
10029 return fpDiv(_dflt_rm(), a, b, self.ctx)
10030

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

◆ __ge__()

__ge__ (   self,
  other 
)

Definition at line 9923 of file z3py.py.

9923 def __ge__(self, other):
9924 return fpGEQ(self, other, self.ctx)
9925

◆ __gt__()

__gt__ (   self,
  other 
)

Definition at line 9926 of file z3py.py.

9926 def __gt__(self, other):
9927 return fpGT(self, other, self.ctx)
9928

◆ __le__()

__le__ (   self,
  other 
)

Definition at line 9917 of file z3py.py.

9917 def __le__(self, other):
9918 return fpLEQ(self, other, self.ctx)
9919

◆ __lt__()

__lt__ (   self,
  other 
)

Definition at line 9920 of file z3py.py.

9920 def __lt__(self, other):
9921 return fpLT(self, other, self.ctx)
9922

◆ __mod__()

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

Definition at line 10052 of file z3py.py.

10052 def __mod__(self, other):
10053 """Create the Z3 expression mod `self % other`."""
10054 return fpRem(self, other)
10055

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

9975 def __mul__(self, other):
9976 """Create the Z3 expression `self * other`.
9977
9978 >>> x = FP('x', FPSort(8, 24))
9979 >>> y = FP('y', FPSort(8, 24))
9980 >>> x * y
9981 x * y
9982 >>> (x * y).sort()
9983 FPSort(8, 24)
9984 >>> 10 * y
9985 1.25*(2**3) * y
9986 """
9987 [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
9988 return fpMul(_dflt_rm(), a, b, self.ctx)
9989

◆ __neg__()

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

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

Definition at line 10007 of file z3py.py.

10007 def __neg__(self):
10008 """Create the Z3 expression `-self`.
10009
10010 >>> x = FP('x', Float32())
10011 >>> -x
10012 -x
10013 """
10014 return fpNeg(self)
10015

◆ __pos__()

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

Definition at line 10003 of file z3py.py.

10003 def __pos__(self):
10004 """Create the Z3 expression `+self`."""
10005 return self
10006

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

9942 def __radd__(self, other):
9943 """Create the Z3 expression `other + self`.
9944
9945 >>> x = FP('x', FPSort(8, 24))
9946 >>> 10 + x
9947 1.25*(2**3) + x
9948 """
9949 [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
9950 return fpAdd(_dflt_rm(), a, b, self.ctx)
9951

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

10031 def __rdiv__(self, other):
10032 """Create the Z3 expression `other / self`.
10033
10034 >>> x = FP('x', FPSort(8, 24))
10035 >>> y = FP('y', FPSort(8, 24))
10036 >>> x / y
10037 x / y
10038 >>> x / 10
10039 x / 1.25*(2**3)
10040 """
10041 [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
10042 return fpDiv(_dflt_rm(), a, b, self.ctx)
10043

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

◆ __rmod__()

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

Definition at line 10056 of file z3py.py.

10056 def __rmod__(self, other):
10057 """Create the Z3 expression mod `other % self`."""
10058 return fpRem(other, self)
10059
10060

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

9990 def __rmul__(self, other):
9991 """Create the Z3 expression `other * self`.
9992
9993 >>> x = FP('x', FPSort(8, 24))
9994 >>> y = FP('y', FPSort(8, 24))
9995 >>> x * y
9996 x * y
9997 >>> x * 10
9998 x * 1.25*(2**3)
9999 """
10000 [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
10001 return fpMul(_dflt_rm(), a, b, self.ctx)
10002

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

9965 def __rsub__(self, other):
9966 """Create the Z3 expression `other - self`.
9967
9968 >>> x = FP('x', FPSort(8, 24))
9969 >>> 10 - x
9970 1.25*(2**3) - x
9971 """
9972 [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
9973 return fpSub(_dflt_rm(), a, b, self.ctx)
9974

◆ __rtruediv__()

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

Definition at line 10048 of file z3py.py.

10048 def __rtruediv__(self, other):
10049 """Create the Z3 expression division `other / self`."""
10050 return self.__rdiv__(other)
10051

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

9952 def __sub__(self, other):
9953 """Create the Z3 expression `self - other`.
9954
9955 >>> x = FP('x', FPSort(8, 24))
9956 >>> y = FP('y', FPSort(8, 24))
9957 >>> x - y
9958 x - y
9959 >>> (x - y).sort()
9960 FPSort(8, 24)
9961 """
9962 [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
9963 return fpSub(_dflt_rm(), a, b, self.ctx)
9964

◆ __truediv__()

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

Definition at line 10044 of file z3py.py.

10044 def __truediv__(self, other):
10045 """Create the Z3 expression division `self / other`."""
10046 return self.__div__(other)
10047

◆ as_string()

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

Reimplemented in FPNumRef.

Definition at line 9913 of file z3py.py.

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

Referenced by IntNumRef.as_long(), and BitVecNumRef.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 9897 of file z3py.py.

9897 def ebits(self):
9898 """Retrieves the number of bits reserved for the exponent in the FloatingPoint expression `self`.
9899 >>> b = FPSort(8, 24)
9900 >>> b.ebits()
9901 8
9902 """
9903 return self.sort().ebits()
9904

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

9905 def sbits(self):
9906 """Retrieves the number of bits reserved for the exponent in the FloatingPoint expression `self`.
9907 >>> b = FPSort(8, 24)
9908 >>> b.sbits()
9909 24
9910 """
9911 return self.sort().sbits()
9912

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

9886 def sort(self):
9887 """Return the sort of the floating-point expression `self`.
9888
9889 >>> x = FP('1.0', FPSort(8, 24))
9890 >>> x.sort()
9891 FPSort(8, 24)
9892 >>> x.sort() == FPSort(8, 24)
9893 True
9894 """
9895 return FPSortRef(Z3_get_sort(self.ctx_ref(), self.as_ast()), self.ctx)
9896
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

Definition at line 9895 of file z3py.py.

Referenced by ArithRef.__add__(), BitVecRef.__add__(), BitVecRef.__and__(), FuncDeclRef.__call__(), AstMap.__contains__(), AstRef.__copy__(), Goal.__copy__(), AstVector.__copy__(), FuncInterp.__copy__(), ModelRef.__copy__(), AstRef.__deepcopy__(), Datatype.__deepcopy__(), ParamsRef.__deepcopy__(), ParamDescrsRef.__deepcopy__(), Goal.__deepcopy__(), AstVector.__deepcopy__(), AstMap.__deepcopy__(), FuncEntry.__deepcopy__(), FuncInterp.__deepcopy__(), ModelRef.__deepcopy__(), Statistics.__deepcopy__(), Context.__del__(), AstRef.__del__(), ScopedConstructor.__del__(), ScopedConstructorList.__del__(), ParamsRef.__del__(), ParamDescrsRef.__del__(), Goal.__del__(), AstVector.__del__(), AstMap.__del__(), FuncEntry.__del__(), FuncInterp.__del__(), ModelRef.__del__(), Statistics.__del__(), Solver.__del__(), ArithRef.__div__(), BitVecRef.__div__(), ExprRef.__eq__(), ArithRef.__ge__(), BitVecRef.__ge__(), AstVector.__getitem__(), ModelRef.__getitem__(), Statistics.__getitem__(), AstMap.__getitem__(), ArithRef.__gt__(), BitVecRef.__gt__(), BitVecRef.__invert__(), ArithRef.__le__(), BitVecRef.__le__(), AstVector.__len__(), AstMap.__len__(), ModelRef.__len__(), Statistics.__len__(), BitVecRef.__lshift__(), ArithRef.__lt__(), BitVecRef.__lt__(), ArithRef.__mod__(), BitVecRef.__mod__(), BoolRef.__mul__(), ArithRef.__mul__(), BitVecRef.__mul__(), ExprRef.__ne__(), ArithRef.__neg__(), BitVecRef.__neg__(), BitVecRef.__or__(), ArithRef.__pow__(), ArithRef.__radd__(), BitVecRef.__radd__(), BitVecRef.__rand__(), ArithRef.__rdiv__(), BitVecRef.__rdiv__(), ParamsRef.__repr__(), ParamDescrsRef.__repr__(), AstMap.__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__(), AstVector.__setitem__(), AstMap.__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(), Solver.push(), AstVector.push(), QuantifierRef.qid(), FuncDeclRef.range(), ArraySortRef.range(), DatatypeSortRef.recognizer(), Context.ref(), AstMap.reset(), Solver.reset(), AstVector.resize(), Solver.set(), ParamsRef.set(), Goal.sexpr(), AstVector.sexpr(), ModelRef.sexpr(), ParamDescrsRef.size(), Goal.size(), QuantifierRef.skolem_id(), AstVector.translate(), AstRef.translate(), Goal.translate(), ModelRef.translate(), ExprRef.update(), DatatypeRef.update_field(), ParamsRef.validate(), FuncEntry.value(), QuantifierRef.var_name(), and QuantifierRef.var_sort().