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

9526  def __add__(self, other):
9527  """Create the Z3 expression `self + other`.
9528 
9529  >>> x = FP('x', FPSort(8, 24))
9530  >>> y = FP('y', FPSort(8, 24))
9531  >>> x + y
9532  x + y
9533  >>> (x + y).sort()
9534  FPSort(8, 24)
9535  """
9536  [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
9537  return fpAdd(_dflt_rm(), a, b, self.ctx)
9538 
def fpAdd(rm, a, b, ctx=None)
Definition: z3py.py:10206

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

9613  def __div__(self, other):
9614  """Create the Z3 expression `self / other`.
9615 
9616  >>> x = FP('x', FPSort(8, 24))
9617  >>> y = FP('y', FPSort(8, 24))
9618  >>> x / y
9619  x / y
9620  >>> (x / y).sort()
9621  FPSort(8, 24)
9622  >>> 10 / y
9623  1.25*(2**3) / y
9624  """
9625  [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
9626  return fpDiv(_dflt_rm(), a, b, self.ctx)
9627 
def fpDiv(rm, a, b, ctx=None)
Definition: z3py.py:10253

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

◆ __ge__()

def __ge__ (   self,
  other 
)

Definition at line 9520 of file z3py.py.

9520  def __ge__(self, other):
9521  return fpGEQ(self, other, self.ctx)
9522 
def fpGEQ(a, b, ctx=None)
Definition: z3py.py:10424

◆ __gt__()

def __gt__ (   self,
  other 
)

Definition at line 9523 of file z3py.py.

9523  def __gt__(self, other):
9524  return fpGT(self, other, self.ctx)
9525 
def fpGT(a, b, ctx=None)
Definition: z3py.py:10412

◆ __le__()

def __le__ (   self,
  other 
)

Definition at line 9514 of file z3py.py.

9514  def __le__(self, other):
9515  return fpLEQ(self, other, self.ctx)
9516 
def fpLEQ(a, b, ctx=None)
Definition: z3py.py:10400

◆ __lt__()

def __lt__ (   self,
  other 
)

Definition at line 9517 of file z3py.py.

9517  def __lt__(self, other):
9518  return fpLT(self, other, self.ctx)
9519 
def fpLT(a, b, ctx=None)
Definition: z3py.py:10388

◆ __mod__()

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

Definition at line 9649 of file z3py.py.

9649  def __mod__(self, other):
9650  """Create the Z3 expression mod `self % other`."""
9651  return fpRem(self, other)
9652 
def fpRem(a, b, ctx=None)
Definition: z3py.py:10268

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

9572  def __mul__(self, other):
9573  """Create the Z3 expression `self * other`.
9574 
9575  >>> x = FP('x', FPSort(8, 24))
9576  >>> y = FP('y', FPSort(8, 24))
9577  >>> x * y
9578  x * y
9579  >>> (x * y).sort()
9580  FPSort(8, 24)
9581  >>> 10 * y
9582  1.25*(2**3) * y
9583  """
9584  [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
9585  return fpMul(_dflt_rm(), a, b, self.ctx)
9586 
def fpMul(rm, a, b, ctx=None)
Definition: z3py.py:10238

◆ __neg__()

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

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

Definition at line 9604 of file z3py.py.

9604  def __neg__(self):
9605  """Create the Z3 expression `-self`.
9606 
9607  >>> x = FP('x', Float32())
9608  >>> -x
9609  -x
9610  """
9611  return fpNeg(self)
9612 
def fpNeg(a, ctx=None)
Definition: z3py.py:10138

◆ __pos__()

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

Definition at line 9600 of file z3py.py.

9600  def __pos__(self):
9601  """Create the Z3 expression `+self`."""
9602  return self
9603 

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

9539  def __radd__(self, other):
9540  """Create the Z3 expression `other + self`.
9541 
9542  >>> x = FP('x', FPSort(8, 24))
9543  >>> 10 + x
9544  1.25*(2**3) + x
9545  """
9546  [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
9547  return fpAdd(_dflt_rm(), a, b, self.ctx)
9548 

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

9628  def __rdiv__(self, other):
9629  """Create the Z3 expression `other / self`.
9630 
9631  >>> x = FP('x', FPSort(8, 24))
9632  >>> y = FP('y', FPSort(8, 24))
9633  >>> x / y
9634  x / y
9635  >>> x / 10
9636  x / 1.25*(2**3)
9637  """
9638  [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
9639  return fpDiv(_dflt_rm(), a, b, self.ctx)
9640 

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

◆ __rmod__()

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

Definition at line 9653 of file z3py.py.

9653  def __rmod__(self, other):
9654  """Create the Z3 expression mod `other % self`."""
9655  return fpRem(other, self)
9656 
9657 

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

9587  def __rmul__(self, other):
9588  """Create the Z3 expression `other * self`.
9589 
9590  >>> x = FP('x', FPSort(8, 24))
9591  >>> y = FP('y', FPSort(8, 24))
9592  >>> x * y
9593  x * y
9594  >>> x * 10
9595  x * 1.25*(2**3)
9596  """
9597  [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
9598  return fpMul(_dflt_rm(), a, b, self.ctx)
9599 

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

9562  def __rsub__(self, other):
9563  """Create the Z3 expression `other - self`.
9564 
9565  >>> x = FP('x', FPSort(8, 24))
9566  >>> 10 - x
9567  1.25*(2**3) - x
9568  """
9569  [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
9570  return fpSub(_dflt_rm(), a, b, self.ctx)
9571 
def fpSub(rm, a, b, ctx=None)
Definition: z3py.py:10223

◆ __rtruediv__()

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

Definition at line 9645 of file z3py.py.

9645  def __rtruediv__(self, other):
9646  """Create the Z3 expression division `other / self`."""
9647  return self.__rdiv__(other)
9648 

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

9549  def __sub__(self, other):
9550  """Create the Z3 expression `self - other`.
9551 
9552  >>> x = FP('x', FPSort(8, 24))
9553  >>> y = FP('y', FPSort(8, 24))
9554  >>> x - y
9555  x - y
9556  >>> (x - y).sort()
9557  FPSort(8, 24)
9558  """
9559  [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
9560  return fpSub(_dflt_rm(), a, b, self.ctx)
9561 

◆ __truediv__()

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

Definition at line 9641 of file z3py.py.

9641  def __truediv__(self, other):
9642  """Create the Z3 expression division `self / other`."""
9643  return self.__div__(other)
9644 

◆ as_string()

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

Reimplemented in FPNumRef.

Definition at line 9510 of file z3py.py.

9510  def as_string(self):
9511  """Return a Z3 floating point expression as a Python string."""
9512  return Z3_ast_to_string(self.ctx_ref(), self.as_ast())
9513 
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 9494 of file z3py.py.

9494  def ebits(self):
9495  """Retrieves the number of bits reserved for the exponent in the FloatingPoint expression `self`.
9496  >>> b = FPSort(8, 24)
9497  >>> b.ebits()
9498  8
9499  """
9500  return self.sort().ebits()
9501 

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

9502  def sbits(self):
9503  """Retrieves the number of bits reserved for the exponent in the FloatingPoint expression `self`.
9504  >>> b = FPSort(8, 24)
9505  >>> b.sbits()
9506  24
9507  """
9508  return self.sort().sbits()
9509 

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

9483  def sort(self):
9484  """Return the sort of the floating-point expression `self`.
9485 
9486  >>> x = FP('1.0', FPSort(8, 24))
9487  >>> x.sort()
9488  FPSort(8, 24)
9489  >>> x.sort() == FPSort(8, 24)
9490  True
9491  """
9492  return FPSortRef(Z3_get_sort(self.ctx_ref(), self.as_ast()), self.ctx)
9493 
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().