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 8837 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 8883 of file z3py.py.

8883  def __add__(self, other):
8884  """Create the Z3 expression `self + other`.
8885 
8886  >>> x = FP('x', FPSort(8, 24))
8887  >>> y = FP('y', FPSort(8, 24))
8888  >>> x + y
8889  x + y
8890  >>> (x + y).sort()
8891  FPSort(8, 24)
8892  """
8893  [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
8894  return fpAdd(_dflt_rm(), a, b, self.ctx)
8895 

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

8970  def __div__(self, other):
8971  """Create the Z3 expression `self / other`.
8972 
8973  >>> x = FP('x', FPSort(8, 24))
8974  >>> y = FP('y', FPSort(8, 24))
8975  >>> x / y
8976  x / y
8977  >>> (x / y).sort()
8978  FPSort(8, 24)
8979  >>> 10 / y
8980  1.25*(2**3) / y
8981  """
8982  [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
8983  return fpDiv(_dflt_rm(), a, b, self.ctx)
8984 

Referenced by FPRef.__truediv__().

◆ __ge__()

def __ge__ (   self,
  other 
)

Definition at line 8877 of file z3py.py.

8877  def __ge__(self, other):
8878  return fpGEQ(self, other, self.ctx)
8879 

◆ __gt__()

def __gt__ (   self,
  other 
)

Definition at line 8880 of file z3py.py.

8880  def __gt__(self, other):
8881  return fpGT(self, other, self.ctx)
8882 

◆ __le__()

def __le__ (   self,
  other 
)

Definition at line 8871 of file z3py.py.

8871  def __le__(self, other):
8872  return fpLEQ(self, other, self.ctx)
8873 

◆ __lt__()

def __lt__ (   self,
  other 
)

Definition at line 8874 of file z3py.py.

8874  def __lt__(self, other):
8875  return fpLT(self, other, self.ctx)
8876 

◆ __mod__()

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

Definition at line 9006 of file z3py.py.

9006  def __mod__(self, other):
9007  """Create the Z3 expression mod `self % other`."""
9008  return fpRem(self, other)
9009 

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

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

◆ __neg__()

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

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

Definition at line 8961 of file z3py.py.

8961  def __neg__(self):
8962  """Create the Z3 expression `-self`.
8963 
8964  >>> x = FP('x', Float32())
8965  >>> -x
8966  -x
8967  """
8968  return fpNeg(self)
8969 

◆ __pos__()

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

Definition at line 8957 of file z3py.py.

8957  def __pos__(self):
8958  """Create the Z3 expression `+self`."""
8959  return self
8960 

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

8896  def __radd__(self, other):
8897  """Create the Z3 expression `other + self`.
8898 
8899  >>> x = FP('x', FPSort(8, 24))
8900  >>> 10 + x
8901  1.25*(2**3) + x
8902  """
8903  [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
8904  return fpAdd(_dflt_rm(), a, b, self.ctx)
8905 

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

8985  def __rdiv__(self, other):
8986  """Create the Z3 expression `other / self`.
8987 
8988  >>> x = FP('x', FPSort(8, 24))
8989  >>> y = FP('y', FPSort(8, 24))
8990  >>> x / y
8991  x / y
8992  >>> x / 10
8993  x / 1.25*(2**3)
8994  """
8995  [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
8996  return fpDiv(_dflt_rm(), a, b, self.ctx)
8997 

Referenced by FPRef.__rtruediv__().

◆ __rmod__()

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

Definition at line 9010 of file z3py.py.

9010  def __rmod__(self, other):
9011  """Create the Z3 expression mod `other % self`."""
9012  return fpRem(other, self)
9013 

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

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

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

8919  def __rsub__(self, other):
8920  """Create the Z3 expression `other - self`.
8921 
8922  >>> x = FP('x', FPSort(8, 24))
8923  >>> 10 - x
8924  1.25*(2**3) - x
8925  """
8926  [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
8927  return fpSub(_dflt_rm(), a, b, self.ctx)
8928 

◆ __rtruediv__()

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

Definition at line 9002 of file z3py.py.

9002  def __rtruediv__(self, other):
9003  """Create the Z3 expression division `other / self`."""
9004  return self.__rdiv__(other)
9005 

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

8906  def __sub__(self, other):
8907  """Create the Z3 expression `self - other`.
8908 
8909  >>> x = FP('x', FPSort(8, 24))
8910  >>> y = FP('y', FPSort(8, 24))
8911  >>> x - y
8912  x - y
8913  >>> (x - y).sort()
8914  FPSort(8, 24)
8915  """
8916  [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
8917  return fpSub(_dflt_rm(), a, b, self.ctx)
8918 

◆ __truediv__()

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

Definition at line 8998 of file z3py.py.

8998  def __truediv__(self, other):
8999  """Create the Z3 expression division `self / other`."""
9000  return self.__div__(other)
9001 

◆ as_string()

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

Reimplemented in FPNumRef.

Definition at line 8867 of file z3py.py.

8867  def as_string(self):
8868  """Return a Z3 floating point expression as a Python string."""
8869  return Z3_ast_to_string(self.ctx_ref(), self.as_ast())
8870 

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

8851  def ebits(self):
8852  """Retrieves the number of bits reserved for the exponent in the FloatingPoint expression `self`.
8853  >>> b = FPSort(8, 24)
8854  >>> b.ebits()
8855  8
8856  """
8857  return self.sort().ebits();
8858 

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

8859  def sbits(self):
8860  """Retrieves the number of bits reserved for the exponent in the FloatingPoint expression `self`.
8861  >>> b = FPSort(8, 24)
8862  >>> b.sbits()
8863  24
8864  """
8865  return self.sort().sbits();
8866 

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

8840  def sort(self):
8841  """Return the sort of the floating-point expression `self`.
8842 
8843  >>> x = FP('1.0', FPSort(8, 24))
8844  >>> x.sort()
8845  FPSort(8, 24)
8846  >>> x.sort() == FPSort(8, 24)
8847  True
8848  """
8849  return FPSortRef(Z3_get_sort(self.ctx_ref(), self.as_ast()), self.ctx)
8850 
z3py.fpLT
def fpLT(a, b, ctx=None)
Definition: z3py.py:9673
z3py.fpGT
def fpGT(a, b, ctx=None)
Definition: z3py.py:9695
z3py.fpMul
def fpMul(rm, a, b, ctx=None)
Definition: z3py.py:9539
z3py.fpGEQ
def fpGEQ(a, b, ctx=None)
Definition: z3py.py:9706
z3py.fpRem
def fpRem(a, b, ctx=None)
Definition: z3py.py:9567
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:9553
z3py.fpAdd
def fpAdd(rm, a, b, ctx=None)
Definition: z3py.py:9509
z3py.fpSub
def fpSub(rm, a, b, ctx=None)
Definition: z3py.py:9525
z3py.fpNeg
def fpNeg(a, ctx=None)
Definition: z3py.py:9449
z3py.fpLEQ
def fpLEQ(a, b, ctx=None)
Definition: z3py.py:9684
Z3_get_sort
Z3_sort Z3_API Z3_get_sort(Z3_context c, Z3_ast a)
Return the sort of an AST node.