Z3
Public Member Functions
FPRef Class Reference

FP Expressions. More...

+ Inheritance diagram for FPRef:

Public Member Functions

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

Additional Inherited Members

- Data Fields inherited from AstRef
 ast
 
 ctx
 

Detailed Description

FP Expressions.

Floating-point expressions.

Definition at line 8795 of file z3py.py.

Member Function Documentation

◆ __add__()

def __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 8841 of file z3py.py.

8841  def __add__(self, other):
8842  """Create the Z3 expression `self + other`.
8843 
8844  >>> x = FP('x', FPSort(8, 24))
8845  >>> y = FP('y', FPSort(8, 24))
8846  >>> x + y
8847  x + y
8848  >>> (x + y).sort()
8849  FPSort(8, 24)
8850  """
8851  [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
8852  return fpAdd(_dflt_rm(), a, b, self.ctx)
8853 

◆ __div__()

def __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 8928 of file z3py.py.

8928  def __div__(self, other):
8929  """Create the Z3 expression `self / other`.
8930 
8931  >>> x = FP('x', FPSort(8, 24))
8932  >>> y = FP('y', FPSort(8, 24))
8933  >>> x / y
8934  x / y
8935  >>> (x / y).sort()
8936  FPSort(8, 24)
8937  >>> 10 / y
8938  1.25*(2**3) / y
8939  """
8940  [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
8941  return fpDiv(_dflt_rm(), a, b, self.ctx)
8942 

Referenced by FPRef.__truediv__().

◆ __ge__()

def __ge__ (   self,
  other 
)

Definition at line 8835 of file z3py.py.

8835  def __ge__(self, other):
8836  return fpGEQ(self, other, self.ctx)
8837 

◆ __gt__()

def __gt__ (   self,
  other 
)

Definition at line 8838 of file z3py.py.

8838  def __gt__(self, other):
8839  return fpGT(self, other, self.ctx)
8840 

◆ __le__()

def __le__ (   self,
  other 
)

Definition at line 8829 of file z3py.py.

8829  def __le__(self, other):
8830  return fpLEQ(self, other, self.ctx)
8831 

◆ __lt__()

def __lt__ (   self,
  other 
)

Definition at line 8832 of file z3py.py.

8832  def __lt__(self, other):
8833  return fpLT(self, other, self.ctx)
8834 

◆ __mod__()

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

Definition at line 8964 of file z3py.py.

8964  def __mod__(self, other):
8965  """Create the Z3 expression mod `self % other`."""
8966  return fpRem(self, other)
8967 

◆ __mul__()

def __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 8887 of file z3py.py.

8887  def __mul__(self, other):
8888  """Create the Z3 expression `self * other`.
8889 
8890  >>> x = FP('x', FPSort(8, 24))
8891  >>> y = FP('y', FPSort(8, 24))
8892  >>> x * y
8893  x * y
8894  >>> (x * y).sort()
8895  FPSort(8, 24)
8896  >>> 10 * y
8897  1.25*(2**3) * y
8898  """
8899  [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
8900  return fpMul(_dflt_rm(), a, b, self.ctx)
8901 

◆ __neg__()

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

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

Definition at line 8919 of file z3py.py.

8919  def __neg__(self):
8920  """Create the Z3 expression `-self`.
8921 
8922  >>> x = FP('x', Float32())
8923  >>> -x
8924  -x
8925  """
8926  return fpNeg(self)
8927 

◆ __pos__()

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

Definition at line 8915 of file z3py.py.

8915  def __pos__(self):
8916  """Create the Z3 expression `+self`."""
8917  return self
8918 

◆ __radd__()

def __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 8854 of file z3py.py.

8854  def __radd__(self, other):
8855  """Create the Z3 expression `other + self`.
8856 
8857  >>> x = FP('x', FPSort(8, 24))
8858  >>> 10 + x
8859  1.25*(2**3) + x
8860  """
8861  [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
8862  return fpAdd(_dflt_rm(), a, b, self.ctx)
8863 

◆ __rdiv__()

def __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 8943 of file z3py.py.

8943  def __rdiv__(self, other):
8944  """Create the Z3 expression `other / self`.
8945 
8946  >>> x = FP('x', FPSort(8, 24))
8947  >>> y = FP('y', FPSort(8, 24))
8948  >>> x / y
8949  x / y
8950  >>> x / 10
8951  x / 1.25*(2**3)
8952  """
8953  [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
8954  return fpDiv(_dflt_rm(), a, b, self.ctx)
8955 

Referenced by FPRef.__rtruediv__().

◆ __rmod__()

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

Definition at line 8968 of file z3py.py.

8968  def __rmod__(self, other):
8969  """Create the Z3 expression mod `other % self`."""
8970  return fpRem(other, self)
8971 

◆ __rmul__()

def __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 8902 of file z3py.py.

8902  def __rmul__(self, other):
8903  """Create the Z3 expression `other * self`.
8904 
8905  >>> x = FP('x', FPSort(8, 24))
8906  >>> y = FP('y', FPSort(8, 24))
8907  >>> x * y
8908  x * y
8909  >>> x * 10
8910  x * 1.25*(2**3)
8911  """
8912  [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
8913  return fpMul(_dflt_rm(), a, b, self.ctx)
8914 

◆ __rsub__()

def __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 8877 of file z3py.py.

8877  def __rsub__(self, other):
8878  """Create the Z3 expression `other - self`.
8879 
8880  >>> x = FP('x', FPSort(8, 24))
8881  >>> 10 - x
8882  1.25*(2**3) - x
8883  """
8884  [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
8885  return fpSub(_dflt_rm(), a, b, self.ctx)
8886 

◆ __rtruediv__()

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

Definition at line 8960 of file z3py.py.

8960  def __rtruediv__(self, other):
8961  """Create the Z3 expression division `other / self`."""
8962  return self.__rdiv__(other)
8963 

◆ __sub__()

def __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 8864 of file z3py.py.

8864  def __sub__(self, other):
8865  """Create the Z3 expression `self - other`.
8866 
8867  >>> x = FP('x', FPSort(8, 24))
8868  >>> y = FP('y', FPSort(8, 24))
8869  >>> x - y
8870  x - y
8871  >>> (x - y).sort()
8872  FPSort(8, 24)
8873  """
8874  [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
8875  return fpSub(_dflt_rm(), a, b, self.ctx)
8876 

◆ __truediv__()

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

Definition at line 8956 of file z3py.py.

8956  def __truediv__(self, other):
8957  """Create the Z3 expression division `self / other`."""
8958  return self.__div__(other)
8959 

◆ as_string()

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

Reimplemented in FPNumRef.

Definition at line 8825 of file z3py.py.

8825  def as_string(self):
8826  """Return a Z3 floating point expression as a Python string."""
8827  return Z3_ast_to_string(self.ctx_ref(), self.as_ast())
8828 

◆ ebits()

def 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 8809 of file z3py.py.

8809  def ebits(self):
8810  """Retrieves the number of bits reserved for the exponent in the FloatingPoint expression `self`.
8811  >>> b = FPSort(8, 24)
8812  >>> b.ebits()
8813  8
8814  """
8815  return self.sort().ebits();
8816 

◆ sbits()

def 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 8817 of file z3py.py.

8817  def sbits(self):
8818  """Retrieves the number of bits reserved for the exponent in the FloatingPoint expression `self`.
8819  >>> b = FPSort(8, 24)
8820  >>> b.sbits()
8821  24
8822  """
8823  return self.sort().sbits();
8824 

◆ sort()

def 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 8798 of file z3py.py.

8798  def sort(self):
8799  """Return the sort of the floating-point expression `self`.
8800 
8801  >>> x = FP('1.0', FPSort(8, 24))
8802  >>> x.sort()
8803  FPSort(8, 24)
8804  >>> x.sort() == FPSort(8, 24)
8805  True
8806  """
8807  return FPSortRef(Z3_get_sort(self.ctx_ref(), self.as_ast()), self.ctx)
8808 
z3py.fpLT
def fpLT(a, b, ctx=None)
Definition: z3py.py:9631
z3py.fpGT
def fpGT(a, b, ctx=None)
Definition: z3py.py:9653
z3py.fpMul
def fpMul(rm, a, b, ctx=None)
Definition: z3py.py:9497
z3py.fpGEQ
def fpGEQ(a, b, ctx=None)
Definition: z3py.py:9664
z3py.fpRem
def fpRem(a, b, ctx=None)
Definition: z3py.py:9525
Z3_ast_to_string
Z3_string Z3_API Z3_ast_to_string(Z3_context c, Z3_ast a)
Convert the given AST node into a string.
z3py.fpDiv
def fpDiv(rm, a, b, ctx=None)
Definition: z3py.py:9511
z3py.fpAdd
def fpAdd(rm, a, b, ctx=None)
Definition: z3py.py:9467
z3py.fpSub
def fpSub(rm, a, b, ctx=None)
Definition: z3py.py:9483
z3py.fpNeg
def fpNeg(a, ctx=None)
Definition: z3py.py:9407
z3py.fpLEQ
def fpLEQ(a, b, ctx=None)
Definition: z3py.py:9642
Z3_get_sort
Z3_sort Z3_API Z3_get_sort(Z3_context c, Z3_ast a)
Return the sort of an AST node.