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 (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 __eq__ (self, other)
 
def __hash__ (self)
 
def __nonzero__ (self)
 
def __bool__ (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 8464 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 8510 of file z3py.py.

8510  def __add__(self, other):
8511  """Create the Z3 expression `self + other`.
8512 
8513  >>> x = FP('x', FPSort(8, 24))
8514  >>> y = FP('y', FPSort(8, 24))
8515  >>> x + y
8516  x + y
8517  >>> (x + y).sort()
8518  FPSort(8, 24)
8519  """
8520  [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
8521  return fpAdd(_dflt_rm(), a, b, self.ctx)
8522 
def fpAdd(rm, a, b, ctx=None)
Definition: z3py.py:9141

§ __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 8597 of file z3py.py.

8597  def __div__(self, other):
8598  """Create the Z3 expression `self / other`.
8599 
8600  >>> x = FP('x', FPSort(8, 24))
8601  >>> y = FP('y', FPSort(8, 24))
8602  >>> x / y
8603  x / y
8604  >>> (x / y).sort()
8605  FPSort(8, 24)
8606  >>> 10 / y
8607  1.25*(2**3) / y
8608  """
8609  [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
8610  return fpDiv(_dflt_rm(), a, b, self.ctx)
8611 
def fpDiv(rm, a, b, ctx=None)
Definition: z3py.py:9185

§ __ge__()

def __ge__ (   self,
  other 
)

Definition at line 8504 of file z3py.py.

8504  def __ge__(self, other):
8505  return fpGEQ(self, other, self.ctx)
8506 
def fpGEQ(a, b, ctx=None)
Definition: z3py.py:9339

§ __gt__()

def __gt__ (   self,
  other 
)

Definition at line 8507 of file z3py.py.

8507  def __gt__(self, other):
8508  return fpGT(self, other, self.ctx)
8509 
def fpGT(a, b, ctx=None)
Definition: z3py.py:9328

§ __le__()

def __le__ (   self,
  other 
)

Definition at line 8498 of file z3py.py.

8498  def __le__(self, other):
8499  return fpLEQ(self, other, self.ctx)
8500 
def fpLEQ(a, b, ctx=None)
Definition: z3py.py:9317

§ __lt__()

def __lt__ (   self,
  other 
)

Definition at line 8501 of file z3py.py.

8501  def __lt__(self, other):
8502  return fpLT(self, other, self.ctx)
8503 
def fpLT(a, b, ctx=None)
Definition: z3py.py:9306

§ __mod__()

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

Definition at line 8634 of file z3py.py.

8634  def __mod__(self, other):
8635  """Create the Z3 expression mod `self % other`."""
8636  return fpRem(self, other)
8637 
def fpRem(a, b, ctx=None)
Definition: z3py.py:9199

§ __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 8556 of file z3py.py.

8556  def __mul__(self, other):
8557  """Create the Z3 expression `self * other`.
8558 
8559  >>> x = FP('x', FPSort(8, 24))
8560  >>> y = FP('y', FPSort(8, 24))
8561  >>> x * y
8562  x * y
8563  >>> (x * y).sort()
8564  FPSort(8, 24)
8565  >>> 10 * y
8566  1.25*(2**3) * y
8567  """
8568  [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
8569  return fpMul(_dflt_rm(), a, b, self.ctx)
8570 
def fpMul(rm, a, b, ctx=None)
Definition: z3py.py:9171

§ __neg__()

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

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

Definition at line 8588 of file z3py.py.

8588  def __neg__(self):
8589  """Create the Z3 expression `-self`.
8590 
8591  >>> x = FP('x', Float32())
8592  >>> -x
8593  -x
8594  """
8595  return fpNeg(self)
8596 
def fpNeg(a, ctx=None)
Definition: z3py.py:9074

§ __pos__()

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

Definition at line 8584 of file z3py.py.

8584  def __pos__(self):
8585  """Create the Z3 expression `+self`."""
8586  return self
8587 

§ __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 8523 of file z3py.py.

8523  def __radd__(self, other):
8524  """Create the Z3 expression `other + self`.
8525 
8526  >>> x = FP('x', FPSort(8, 24))
8527  >>> 10 + x
8528  1.25*(2**3) + x
8529  """
8530  [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
8531  return fpAdd(_dflt_rm(), a, b, self.ctx)
8532 
def fpAdd(rm, a, b, ctx=None)
Definition: z3py.py:9141

§ __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 8612 of file z3py.py.

8612  def __rdiv__(self, other):
8613  """Create the Z3 expression `other / self`.
8614 
8615  >>> x = FP('x', FPSort(8, 24))
8616  >>> y = FP('y', FPSort(8, 24))
8617  >>> x / y
8618  x / y
8619  >>> x / 10
8620  x / 1.25*(2**3)
8621  """
8622  [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
8623  return fpDiv(_dflt_rm(), a, b, self.ctx)
8624 
def fpDiv(rm, a, b, ctx=None)
Definition: z3py.py:9185

§ __rmod__()

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

Definition at line 8638 of file z3py.py.

8638  def __rmod__(self, other):
8639  """Create the Z3 expression mod `other % self`."""
8640  return fpRem(other, self)
8641 
def fpRem(a, b, ctx=None)
Definition: z3py.py:9199

§ __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 8571 of file z3py.py.

8571  def __rmul__(self, other):
8572  """Create the Z3 expression `other * self`.
8573 
8574  >>> x = FP('x', FPSort(8, 24))
8575  >>> y = FP('y', FPSort(8, 24))
8576  >>> x * y
8577  x * y
8578  >>> x * 10
8579  x * 1.25*(2**3)
8580  """
8581  [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
8582  return fpMul(_dflt_rm(), a, b, self.ctx)
8583 
def fpMul(rm, a, b, ctx=None)
Definition: z3py.py:9171

§ __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 8546 of file z3py.py.

8546  def __rsub__(self, other):
8547  """Create the Z3 expression `other - self`.
8548 
8549  >>> x = FP('x', FPSort(8, 24))
8550  >>> 10 - x
8551  1.25*(2**3) - x
8552  """
8553  [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
8554  return fpSub(_dflt_rm(), a, b, self.ctx)
8555 
def fpSub(rm, a, b, ctx=None)
Definition: z3py.py:9157

§ __rtruediv__()

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

Definition at line 8630 of file z3py.py.

8630  def __rtruediv__(self, other):
8631  """Create the Z3 expression division `other / self`."""
8632  return self.__rdiv__(other)
8633 

§ __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 8533 of file z3py.py.

8533  def __sub__(self, other):
8534  """Create the Z3 expression `self - other`.
8535 
8536  >>> x = FP('x', FPSort(8, 24))
8537  >>> y = FP('y', FPSort(8, 24))
8538  >>> x - y
8539  x - y
8540  >>> (x - y).sort()
8541  FPSort(8, 24)
8542  """
8543  [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
8544  return fpSub(_dflt_rm(), a, b, self.ctx)
8545 
def fpSub(rm, a, b, ctx=None)
Definition: z3py.py:9157

§ __truediv__()

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

Definition at line 8626 of file z3py.py.

8626  def __truediv__(self, other):
8627  """Create the Z3 expression division `self / other`."""
8628  return self.__div__(other)
8629 

§ as_string()

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

Definition at line 8494 of file z3py.py.

8494  def as_string(self):
8495  """Return a Z3 floating point expression as a Python string."""
8496  return Z3_ast_to_string(self.ctx_ref(), self.as_ast())
8497 
Z3_string Z3_API Z3_ast_to_string(Z3_context c, Z3_ast a)
Convert the given AST node into a string.

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

8478  def ebits(self):
8479  """Retrieves the number of bits reserved for the exponent in the FloatingPoint expression `self`.
8480  >>> b = FPSort(8, 24)
8481  >>> b.ebits()
8482  8
8483  """
8484  return self.sort().ebits();
8485 

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

8486  def sbits(self):
8487  """Retrieves the number of bits reserved for the exponent in the FloatingPoint expression `self`.
8488  >>> b = FPSort(8, 24)
8489  >>> b.sbits()
8490  24
8491  """
8492  return self.sort().sbits();
8493 

§ 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

Definition at line 8467 of file z3py.py.

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

8467  def sort(self):
8468  """Return the sort of the floating-point expression `self`.
8469 
8470  >>> x = FP('1.0', FPSort(8, 24))
8471  >>> x.sort()
8472  FPSort(8, 24)
8473  >>> x.sort() == FPSort(8, 24)
8474  True
8475  """
8476  return FPSortRef(Z3_get_sort(self.ctx_ref(), self.as_ast()), self.ctx)
8477 
Z3_sort Z3_API Z3_get_sort(Z3_context c, Z3_ast a)
Return the sort of an AST node.