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

8864  def __add__(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 fpAdd(_dflt_rm(), a, b, self.ctx)
8876 

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

8951  def __div__(self, other):
8952  """Create the Z3 expression `self / other`.
8953 
8954  >>> x = FP('x', FPSort(8, 24))
8955  >>> y = FP('y', FPSort(8, 24))
8956  >>> x / y
8957  x / y
8958  >>> (x / y).sort()
8959  FPSort(8, 24)
8960  >>> 10 / y
8961  1.25*(2**3) / y
8962  """
8963  [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
8964  return fpDiv(_dflt_rm(), a, b, self.ctx)
8965 

Referenced by FPRef.__truediv__().

◆ __ge__()

def __ge__ (   self,
  other 
)

Definition at line 8858 of file z3py.py.

8858  def __ge__(self, other):
8859  return fpGEQ(self, other, self.ctx)
8860 

◆ __gt__()

def __gt__ (   self,
  other 
)

Definition at line 8861 of file z3py.py.

8861  def __gt__(self, other):
8862  return fpGT(self, other, self.ctx)
8863 

◆ __le__()

def __le__ (   self,
  other 
)

Definition at line 8852 of file z3py.py.

8852  def __le__(self, other):
8853  return fpLEQ(self, other, self.ctx)
8854 

◆ __lt__()

def __lt__ (   self,
  other 
)

Definition at line 8855 of file z3py.py.

8855  def __lt__(self, other):
8856  return fpLT(self, other, self.ctx)
8857 

◆ __mod__()

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

Definition at line 8987 of file z3py.py.

8987  def __mod__(self, other):
8988  """Create the Z3 expression mod `self % other`."""
8989  return fpRem(self, other)
8990 

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

8910  def __mul__(self, other):
8911  """Create the Z3 expression `self * other`.
8912 
8913  >>> x = FP('x', FPSort(8, 24))
8914  >>> y = FP('y', FPSort(8, 24))
8915  >>> x * y
8916  x * y
8917  >>> (x * y).sort()
8918  FPSort(8, 24)
8919  >>> 10 * y
8920  1.25*(2**3) * y
8921  """
8922  [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
8923  return fpMul(_dflt_rm(), a, b, self.ctx)
8924 

◆ __neg__()

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

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

Definition at line 8942 of file z3py.py.

8942  def __neg__(self):
8943  """Create the Z3 expression `-self`.
8944 
8945  >>> x = FP('x', Float32())
8946  >>> -x
8947  -x
8948  """
8949  return fpNeg(self)
8950 

◆ __pos__()

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

Definition at line 8938 of file z3py.py.

8938  def __pos__(self):
8939  """Create the Z3 expression `+self`."""
8940  return self
8941 

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

8877  def __radd__(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 fpAdd(_dflt_rm(), a, b, self.ctx)
8886 

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

8966  def __rdiv__(self, other):
8967  """Create the Z3 expression `other / self`.
8968 
8969  >>> x = FP('x', FPSort(8, 24))
8970  >>> y = FP('y', FPSort(8, 24))
8971  >>> x / y
8972  x / y
8973  >>> x / 10
8974  x / 1.25*(2**3)
8975  """
8976  [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
8977  return fpDiv(_dflt_rm(), a, b, self.ctx)
8978 

Referenced by FPRef.__rtruediv__().

◆ __rmod__()

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

Definition at line 8991 of file z3py.py.

8991  def __rmod__(self, other):
8992  """Create the Z3 expression mod `other % self`."""
8993  return fpRem(other, self)
8994 

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

8925  def __rmul__(self, other):
8926  """Create the Z3 expression `other * self`.
8927 
8928  >>> x = FP('x', FPSort(8, 24))
8929  >>> y = FP('y', FPSort(8, 24))
8930  >>> x * y
8931  x * y
8932  >>> x * 10
8933  x * 1.25*(2**3)
8934  """
8935  [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
8936  return fpMul(_dflt_rm(), a, b, self.ctx)
8937 

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

8900  def __rsub__(self, other):
8901  """Create the Z3 expression `other - self`.
8902 
8903  >>> x = FP('x', FPSort(8, 24))
8904  >>> 10 - x
8905  1.25*(2**3) - x
8906  """
8907  [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
8908  return fpSub(_dflt_rm(), a, b, self.ctx)
8909 

◆ __rtruediv__()

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

Definition at line 8983 of file z3py.py.

8983  def __rtruediv__(self, other):
8984  """Create the Z3 expression division `other / self`."""
8985  return self.__rdiv__(other)
8986 

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

8887  def __sub__(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  """
8897  [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
8898  return fpSub(_dflt_rm(), a, b, self.ctx)
8899 

◆ __truediv__()

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

Definition at line 8979 of file z3py.py.

8979  def __truediv__(self, other):
8980  """Create the Z3 expression division `self / other`."""
8981  return self.__div__(other)
8982 

◆ as_string()

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

Reimplemented in FPNumRef.

Definition at line 8848 of file z3py.py.

8848  def as_string(self):
8849  """Return a Z3 floating point expression as a Python string."""
8850  return Z3_ast_to_string(self.ctx_ref(), self.as_ast())
8851 

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

8832  def ebits(self):
8833  """Retrieves the number of bits reserved for the exponent in the FloatingPoint expression `self`.
8834  >>> b = FPSort(8, 24)
8835  >>> b.ebits()
8836  8
8837  """
8838  return self.sort().ebits();
8839 

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

8840  def sbits(self):
8841  """Retrieves the number of bits reserved for the exponent in the FloatingPoint expression `self`.
8842  >>> b = FPSort(8, 24)
8843  >>> b.sbits()
8844  24
8845  """
8846  return self.sort().sbits();
8847 

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

8821  def sort(self):
8822  """Return the sort of the floating-point expression `self`.
8823 
8824  >>> x = FP('1.0', FPSort(8, 24))
8825  >>> x.sort()
8826  FPSort(8, 24)
8827  >>> x.sort() == FPSort(8, 24)
8828  True
8829  """
8830  return FPSortRef(Z3_get_sort(self.ctx_ref(), self.as_ast()), self.ctx)
8831 
z3py.fpLT
def fpLT(a, b, ctx=None)
Definition: z3py.py:9654
z3py.fpGT
def fpGT(a, b, ctx=None)
Definition: z3py.py:9676
z3py.fpMul
def fpMul(rm, a, b, ctx=None)
Definition: z3py.py:9520
z3py.fpGEQ
def fpGEQ(a, b, ctx=None)
Definition: z3py.py:9687
z3py.fpRem
def fpRem(a, b, ctx=None)
Definition: z3py.py:9548
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:9534
z3py.fpAdd
def fpAdd(rm, a, b, ctx=None)
Definition: z3py.py:9490
z3py.fpSub
def fpSub(rm, a, b, ctx=None)
Definition: z3py.py:9506
z3py.fpNeg
def fpNeg(a, ctx=None)
Definition: z3py.py:9430
z3py.fpLEQ
def fpLEQ(a, b, ctx=None)
Definition: z3py.py:9665
Z3_get_sort
Z3_sort Z3_API Z3_get_sort(Z3_context c, Z3_ast a)
Return the sort of an AST node.