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 __ne__ (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 __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 (self)
 
def sort_kind (self)
 
def __eq__ (self, other)
 
def __ne__ (self, other)
 
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 __str__ (self)
 
def __repr__ (self)
 
def sexpr (self)
 
def as_ast (self)
 
def get_id (self)
 
def ctx_ref (self)
 
def eq (self, other)
 
def translate (self, target)
 
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 7800 of file z3py.py.

Member Function Documentation

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

7850  def __add__(self, other):
7851  """Create the Z3 expression `self + other`.
7852 
7853  >>> x = FP('x', FPSort(8, 24))
7854  >>> y = FP('y', FPSort(8, 24))
7855  >>> x + y
7856  x + y
7857  >>> (x + y).sort()
7858  FPSort(8, 24)
7859  """
7860  a, b = z3._coerce_exprs(self, other)
7861  return fpAdd(_dflt_rm(), self, other)
7862 
def fpAdd(rm, a, b)
Definition: z3py.py:8299
def __add__(self, other)
Definition: z3py.py:7850
def __ge__ (   self,
  other 
)

Definition at line 7840 of file z3py.py.

7840  def __ge__(self, other):
7841  return fpGEQ(self, other)
7842 
def __ge__(self, other)
Definition: z3py.py:7840
def fpGEQ(a, b)
Definition: z3py.py:8553
def __gt__ (   self,
  other 
)

Definition at line 7843 of file z3py.py.

7843  def __gt__(self, other):
7844  return fpGT(self, other)
7845 
def __gt__(self, other)
Definition: z3py.py:7843
def fpGT(a, b)
Definition: z3py.py:8539
def __le__ (   self,
  other 
)

Definition at line 7834 of file z3py.py.

7834  def __le__(self, other):
7835  return fpLEQ(self, other)
7836 
def fpLEQ(a, b)
Definition: z3py.py:8526
def __le__(self, other)
Definition: z3py.py:7834
def __lt__ (   self,
  other 
)

Definition at line 7837 of file z3py.py.

7837  def __lt__(self, other):
7838  return fpLEQ(self, other)
7839 
def fpLEQ(a, b)
Definition: z3py.py:8526
def __lt__(self, other)
Definition: z3py.py:7837
def __mod__ (   self,
  other 
)
Create the Z3 expression mod `self % other`.

Definition at line 7940 of file z3py.py.

7940  def __mod__(self, other):
7941  """Create the Z3 expression mod `self % other`."""
7942  return fpRem(self, other)
7943 
def fpRem(a, b)
Definition: z3py.py:8371
def __mod__(self, other)
Definition: z3py.py:7940
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 7896 of file z3py.py.

7896  def __mul__(self, other):
7897  """Create the Z3 expression `self * other`.
7898 
7899  >>> x = FP('x', FPSort(8, 24))
7900  >>> y = FP('y', FPSort(8, 24))
7901  >>> x * y
7902  x * y
7903  >>> (x * y).sort()
7904  FPSort(8, 24)
7905  >>> 10 * y
7906  1.25*(2**3) * y
7907  """
7908  a, b = z3._coerce_exprs(self, other)
7909  return fpMul(_dflt_rm(), self, other)
7910 
def fpMul(rm, a, b)
Definition: z3py.py:8335
def __mul__(self, other)
Definition: z3py.py:7896
def __ne__ (   self,
  other 
)

Definition at line 7846 of file z3py.py.

7846  def __ne__(self, other):
7847  return fpNEQ(self, other)
7848 
7849 
def fpNEQ(a, b)
Definition: z3py.py:8581
def __ne__(self, other)
Definition: z3py.py:7846
def __neg__ (   self)
Create the Z3 expression `-self`.

Definition at line 7928 of file z3py.py.

7928  def __neg__(self):
7929  """Create the Z3 expression `-self`."""
7930  return FPRef(fpNeg(self))
7931 
FP Expressions.
Definition: z3py.py:7800
def __neg__(self)
Definition: z3py.py:7928
def fpNeg(a)
Definition: z3py.py:8277
def __pos__ (   self)
Create the Z3 expression `+self`.

Definition at line 7924 of file z3py.py.

7924  def __pos__(self):
7925  """Create the Z3 expression `+self`."""
7926  return self
7927 
def __pos__(self)
Definition: z3py.py:7924
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 7863 of file z3py.py.

7863  def __radd__(self, other):
7864  """Create the Z3 expression `other + self`.
7865 
7866  >>> x = FP('x', FPSort(8, 24))
7867  >>> 10 + x
7868  1.25*(2**3) + x
7869  """
7870  a, b = _coerce_exprs(self, other)
7871  return fpAdd(_dflt_rm(), other, self)
7872 
def fpAdd(rm, a, b)
Definition: z3py.py:8299
def __radd__(self, other)
Definition: z3py.py:7863
def __rmod__ (   self,
  other 
)
Create the Z3 expression mod `other % self`.

Definition at line 7944 of file z3py.py.

7944  def __rmod__(self, other):
7945  """Create the Z3 expression mod `other % self`."""
7946  return fpRem(other, self)
7947 
def fpRem(a, b)
Definition: z3py.py:8371
def __rmod__(self, other)
Definition: z3py.py:7944
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 7911 of file z3py.py.

7911  def __rmul__(self, other):
7912  """Create the Z3 expression `other * self`.
7913 
7914  >>> x = FP('x', FPSort(8, 24))
7915  >>> y = FP('y', FPSort(8, 24))
7916  >>> x * y
7917  x * y
7918  >>> x * 10
7919  x * 1.25*(2**3)
7920  """
7921  a, b = _coerce_exprs(self, other)
7922  return fpMul(_dflt_rm(), other, self)
7923 
def __rmul__(self, other)
Definition: z3py.py:7911
def fpMul(rm, a, b)
Definition: z3py.py:8335
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 7886 of file z3py.py.

7886  def __rsub__(self, other):
7887  """Create the Z3 expression `other - self`.
7888 
7889  >>> x = FP('x', FPSort(8, 24))
7890  >>> 10 - x
7891  1.25*(2**3) - x
7892  """
7893  a, b = _coerce_exprs(self, other)
7894  return fpSub(_dflt_rm(), other, self)
7895 
def fpSub(rm, a, b)
Definition: z3py.py:8317
def __rsub__(self, other)
Definition: z3py.py:7886
def __rtruediv__ (   self,
  other 
)
Create the Z3 expression division `other / self`.

Definition at line 7936 of file z3py.py.

7936  def __rtruediv__(self, other):
7937  """Create the Z3 expression division `other / self`."""
7938  return self.__rdiv__(other)
7939 
def __rtruediv__(self, other)
Definition: z3py.py:7936
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 7873 of file z3py.py.

7873  def __sub__(self, other):
7874  """Create the Z3 expression `self - other`.
7875 
7876  >>> x = FP('x', FPSort(8, 24))
7877  >>> y = FP('y', FPSort(8, 24))
7878  >>> x - y
7879  x - y
7880  >>> (x - y).sort()
7881  FPSort(8, 24)
7882  """
7883  a, b = z3._coerce_exprs(self, other)
7884  return fpSub(_dflt_rm(), self, other)
7885 
def fpSub(rm, a, b)
Definition: z3py.py:8317
def __sub__(self, other)
Definition: z3py.py:7873
def __truediv__ (   self,
  other 
)
Create the Z3 expression division `self / other`.

Definition at line 7932 of file z3py.py.

7932  def __truediv__(self, other):
7933  """Create the Z3 expression division `self / other`."""
7934  return self.__div__(other)
7935 
def __truediv__(self, other)
Definition: z3py.py:7932
def as_string (   self)
Return a Z3 floating point expression as a Python string.

Definition at line 7830 of file z3py.py.

7830  def as_string(self):
7831  """Return a Z3 floating point expression as a Python string."""
7832  return Z3_ast_to_string(self.ctx_ref(), self.as_ast())
7833 
Z3_string Z3_API Z3_ast_to_string(Z3_context c, Z3_ast a)
Convert the given AST node into a string.
def as_ast(self)
Definition: z3py.py:296
def ctx_ref(self)
Definition: z3py.py:304
def as_string(self)
Definition: z3py.py:7830
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 7814 of file z3py.py.

7814  def ebits(self):
7815  """Retrieves the number of bits reserved for the exponent in the FloatingPoint expression `self`.
7816  >>> b = FPSort(8, 24)
7817  >>> b.ebits()
7818  8
7819  """
7820  return self.sort().ebits();
7821 
def sort(self)
Definition: z3py.py:752
def ebits(self)
Definition: z3py.py:7814
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 7822 of file z3py.py.

7822  def sbits(self):
7823  """Retrieves the number of bits reserved for the exponent in the FloatingPoint expression `self`.
7824  >>> b = FPSort(8, 24)
7825  >>> b.sbits()
7826  24
7827  """
7828  return self.sort().sbits();
7829 
def sbits(self)
Definition: z3py.py:7822
def sort(self)
Definition: z3py.py:752
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

Definition at line 7803 of file z3py.py.

Referenced by FPRef.__add__(), FPRef.__mul__(), and FPRef.__sub__().

7803  def sort(self):
7804  """Return the sort of the floating-point expression `self`.
7805 
7806  >>> x = FP('1.0', FPSort(8, 24))
7807  >>> x.sort()
7808  FPSort(8, 24)
7809  >>> x.sort() == FPSort(8, 24)
7810  True
7811  """
7812  return FPSortRef(Z3_get_sort(self.ctx_ref(), self.as_ast()), self.ctx)
7813 
def as_ast(self)
Definition: z3py.py:296
def sort(self)
Definition: z3py.py:7803
FP Sorts.
Definition: z3py.py:7698
def ctx_ref(self)
Definition: z3py.py:304
Z3_sort Z3_API Z3_get_sort(Z3_context c, Z3_ast a)
Return the sort of an AST node.