Z3
Public Member Functions
FPRef Class Reference
+ 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)
 
def from_string (self, s)
 
def serialize (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

Floating-point expressions.

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

9659  def __add__(self, other):
9660  """Create the Z3 expression `self + other`.
9661 
9662  >>> x = FP('x', FPSort(8, 24))
9663  >>> y = FP('y', FPSort(8, 24))
9664  >>> x + y
9665  x + y
9666  >>> (x + y).sort()
9667  FPSort(8, 24)
9668  """
9669  [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
9670  return fpAdd(_dflt_rm(), a, b, self.ctx)
9671 
def fpAdd(rm, a, b, ctx=None)
Definition: z3py.py:10339

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

9746  def __div__(self, other):
9747  """Create the Z3 expression `self / other`.
9748 
9749  >>> x = FP('x', FPSort(8, 24))
9750  >>> y = FP('y', FPSort(8, 24))
9751  >>> x / y
9752  x / y
9753  >>> (x / y).sort()
9754  FPSort(8, 24)
9755  >>> 10 / y
9756  1.25*(2**3) / y
9757  """
9758  [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
9759  return fpDiv(_dflt_rm(), a, b, self.ctx)
9760 
def fpDiv(rm, a, b, ctx=None)
Definition: z3py.py:10386

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

◆ __ge__()

def __ge__ (   self,
  other 
)

Definition at line 9653 of file z3py.py.

9653  def __ge__(self, other):
9654  return fpGEQ(self, other, self.ctx)
9655 
def fpGEQ(a, b, ctx=None)
Definition: z3py.py:10557

◆ __gt__()

def __gt__ (   self,
  other 
)

Definition at line 9656 of file z3py.py.

9656  def __gt__(self, other):
9657  return fpGT(self, other, self.ctx)
9658 
def fpGT(a, b, ctx=None)
Definition: z3py.py:10545

◆ __le__()

def __le__ (   self,
  other 
)

Definition at line 9647 of file z3py.py.

9647  def __le__(self, other):
9648  return fpLEQ(self, other, self.ctx)
9649 
def fpLEQ(a, b, ctx=None)
Definition: z3py.py:10533

◆ __lt__()

def __lt__ (   self,
  other 
)

Definition at line 9650 of file z3py.py.

9650  def __lt__(self, other):
9651  return fpLT(self, other, self.ctx)
9652 
def fpLT(a, b, ctx=None)
Definition: z3py.py:10521

◆ __mod__()

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

Definition at line 9782 of file z3py.py.

9782  def __mod__(self, other):
9783  """Create the Z3 expression mod `self % other`."""
9784  return fpRem(self, other)
9785 
def fpRem(a, b, ctx=None)
Definition: z3py.py:10401

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

9705  def __mul__(self, other):
9706  """Create the Z3 expression `self * other`.
9707 
9708  >>> x = FP('x', FPSort(8, 24))
9709  >>> y = FP('y', FPSort(8, 24))
9710  >>> x * y
9711  x * y
9712  >>> (x * y).sort()
9713  FPSort(8, 24)
9714  >>> 10 * y
9715  1.25*(2**3) * y
9716  """
9717  [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
9718  return fpMul(_dflt_rm(), a, b, self.ctx)
9719 
def fpMul(rm, a, b, ctx=None)
Definition: z3py.py:10371

◆ __neg__()

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

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

Definition at line 9737 of file z3py.py.

9737  def __neg__(self):
9738  """Create the Z3 expression `-self`.
9739 
9740  >>> x = FP('x', Float32())
9741  >>> -x
9742  -x
9743  """
9744  return fpNeg(self)
9745 
def fpNeg(a, ctx=None)
Definition: z3py.py:10271

◆ __pos__()

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

Definition at line 9733 of file z3py.py.

9733  def __pos__(self):
9734  """Create the Z3 expression `+self`."""
9735  return self
9736 

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

9672  def __radd__(self, other):
9673  """Create the Z3 expression `other + self`.
9674 
9675  >>> x = FP('x', FPSort(8, 24))
9676  >>> 10 + x
9677  1.25*(2**3) + x
9678  """
9679  [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
9680  return fpAdd(_dflt_rm(), a, b, self.ctx)
9681 

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

9761  def __rdiv__(self, other):
9762  """Create the Z3 expression `other / self`.
9763 
9764  >>> x = FP('x', FPSort(8, 24))
9765  >>> y = FP('y', FPSort(8, 24))
9766  >>> x / y
9767  x / y
9768  >>> x / 10
9769  x / 1.25*(2**3)
9770  """
9771  [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
9772  return fpDiv(_dflt_rm(), a, b, self.ctx)
9773 

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

◆ __rmod__()

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

Definition at line 9786 of file z3py.py.

9786  def __rmod__(self, other):
9787  """Create the Z3 expression mod `other % self`."""
9788  return fpRem(other, self)
9789 
9790 

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

9720  def __rmul__(self, other):
9721  """Create the Z3 expression `other * self`.
9722 
9723  >>> x = FP('x', FPSort(8, 24))
9724  >>> y = FP('y', FPSort(8, 24))
9725  >>> x * y
9726  x * y
9727  >>> x * 10
9728  x * 1.25*(2**3)
9729  """
9730  [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
9731  return fpMul(_dflt_rm(), a, b, self.ctx)
9732 

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

9695  def __rsub__(self, other):
9696  """Create the Z3 expression `other - self`.
9697 
9698  >>> x = FP('x', FPSort(8, 24))
9699  >>> 10 - x
9700  1.25*(2**3) - x
9701  """
9702  [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
9703  return fpSub(_dflt_rm(), a, b, self.ctx)
9704 
def fpSub(rm, a, b, ctx=None)
Definition: z3py.py:10356

◆ __rtruediv__()

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

Definition at line 9778 of file z3py.py.

9778  def __rtruediv__(self, other):
9779  """Create the Z3 expression division `other / self`."""
9780  return self.__rdiv__(other)
9781 

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

9682  def __sub__(self, other):
9683  """Create the Z3 expression `self - other`.
9684 
9685  >>> x = FP('x', FPSort(8, 24))
9686  >>> y = FP('y', FPSort(8, 24))
9687  >>> x - y
9688  x - y
9689  >>> (x - y).sort()
9690  FPSort(8, 24)
9691  """
9692  [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
9693  return fpSub(_dflt_rm(), a, b, self.ctx)
9694 

◆ __truediv__()

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

Definition at line 9774 of file z3py.py.

9774  def __truediv__(self, other):
9775  """Create the Z3 expression division `self / other`."""
9776  return self.__div__(other)
9777 

◆ as_string()

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

Reimplemented in FPNumRef.

Definition at line 9643 of file z3py.py.

9643  def as_string(self):
9644  """Return a Z3 floating point expression as a Python string."""
9645  return Z3_ast_to_string(self.ctx_ref(), self.as_ast())
9646 
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(), BitVecNumRef.as_long(), and FiniteDomainNumRef.as_long().

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

9627  def ebits(self):
9628  """Retrieves the number of bits reserved for the exponent in the FloatingPoint expression `self`.
9629  >>> b = FPSort(8, 24)
9630  >>> b.ebits()
9631  8
9632  """
9633  return self.sort().ebits()
9634 

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

9635  def sbits(self):
9636  """Retrieves the number of bits reserved for the exponent in the FloatingPoint expression `self`.
9637  >>> b = FPSort(8, 24)
9638  >>> b.sbits()
9639  24
9640  """
9641  return self.sort().sbits()
9642 

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

9616  def sort(self):
9617  """Return the sort of the floating-point expression `self`.
9618 
9619  >>> x = FP('1.0', FPSort(8, 24))
9620  >>> x.sort()
9621  FPSort(8, 24)
9622  >>> x.sort() == FPSort(8, 24)
9623  True
9624  """
9625  return FPSortRef(Z3_get_sort(self.ctx_ref(), self.as_ast()), self.ctx)
9626 
Z3_sort Z3_API Z3_get_sort(Z3_context c, Z3_ast a)
Return the sort of an AST node.

Referenced by FPNumRef.as_string(), ArrayRef.domain(), ArrayRef.domain_n(), FPRef.ebits(), ArithRef.is_int(), ArithRef.is_real(), ArrayRef.range(), FPRef.sbits(), BitVecRef.size(), and ExprRef.sort_kind().