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

9429  def __add__(self, other):
9430  """Create the Z3 expression `self + other`.
9431 
9432  >>> x = FP('x', FPSort(8, 24))
9433  >>> y = FP('y', FPSort(8, 24))
9434  >>> x + y
9435  x + y
9436  >>> (x + y).sort()
9437  FPSort(8, 24)
9438  """
9439  [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
9440  return fpAdd(_dflt_rm(), a, b, self.ctx)
9441 
def fpAdd(rm, a, b, ctx=None)
Definition: z3py.py:10109

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

9516  def __div__(self, other):
9517  """Create the Z3 expression `self / other`.
9518 
9519  >>> x = FP('x', FPSort(8, 24))
9520  >>> y = FP('y', FPSort(8, 24))
9521  >>> x / y
9522  x / y
9523  >>> (x / y).sort()
9524  FPSort(8, 24)
9525  >>> 10 / y
9526  1.25*(2**3) / y
9527  """
9528  [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
9529  return fpDiv(_dflt_rm(), a, b, self.ctx)
9530 
def fpDiv(rm, a, b, ctx=None)
Definition: z3py.py:10156

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

◆ __ge__()

def __ge__ (   self,
  other 
)

Definition at line 9423 of file z3py.py.

9423  def __ge__(self, other):
9424  return fpGEQ(self, other, self.ctx)
9425 
def fpGEQ(a, b, ctx=None)
Definition: z3py.py:10327

◆ __gt__()

def __gt__ (   self,
  other 
)

Definition at line 9426 of file z3py.py.

9426  def __gt__(self, other):
9427  return fpGT(self, other, self.ctx)
9428 
def fpGT(a, b, ctx=None)
Definition: z3py.py:10315

◆ __le__()

def __le__ (   self,
  other 
)

Definition at line 9417 of file z3py.py.

9417  def __le__(self, other):
9418  return fpLEQ(self, other, self.ctx)
9419 
def fpLEQ(a, b, ctx=None)
Definition: z3py.py:10303

◆ __lt__()

def __lt__ (   self,
  other 
)

Definition at line 9420 of file z3py.py.

9420  def __lt__(self, other):
9421  return fpLT(self, other, self.ctx)
9422 
def fpLT(a, b, ctx=None)
Definition: z3py.py:10291

◆ __mod__()

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

Definition at line 9552 of file z3py.py.

9552  def __mod__(self, other):
9553  """Create the Z3 expression mod `self % other`."""
9554  return fpRem(self, other)
9555 
def fpRem(a, b, ctx=None)
Definition: z3py.py:10171

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

9475  def __mul__(self, other):
9476  """Create the Z3 expression `self * other`.
9477 
9478  >>> x = FP('x', FPSort(8, 24))
9479  >>> y = FP('y', FPSort(8, 24))
9480  >>> x * y
9481  x * y
9482  >>> (x * y).sort()
9483  FPSort(8, 24)
9484  >>> 10 * y
9485  1.25*(2**3) * y
9486  """
9487  [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
9488  return fpMul(_dflt_rm(), a, b, self.ctx)
9489 
def fpMul(rm, a, b, ctx=None)
Definition: z3py.py:10141

◆ __neg__()

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

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

Definition at line 9507 of file z3py.py.

9507  def __neg__(self):
9508  """Create the Z3 expression `-self`.
9509 
9510  >>> x = FP('x', Float32())
9511  >>> -x
9512  -x
9513  """
9514  return fpNeg(self)
9515 
def fpNeg(a, ctx=None)
Definition: z3py.py:10041

◆ __pos__()

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

Definition at line 9503 of file z3py.py.

9503  def __pos__(self):
9504  """Create the Z3 expression `+self`."""
9505  return self
9506 

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

9442  def __radd__(self, other):
9443  """Create the Z3 expression `other + self`.
9444 
9445  >>> x = FP('x', FPSort(8, 24))
9446  >>> 10 + x
9447  1.25*(2**3) + x
9448  """
9449  [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
9450  return fpAdd(_dflt_rm(), a, b, self.ctx)
9451 

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

9531  def __rdiv__(self, other):
9532  """Create the Z3 expression `other / self`.
9533 
9534  >>> x = FP('x', FPSort(8, 24))
9535  >>> y = FP('y', FPSort(8, 24))
9536  >>> x / y
9537  x / y
9538  >>> x / 10
9539  x / 1.25*(2**3)
9540  """
9541  [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
9542  return fpDiv(_dflt_rm(), a, b, self.ctx)
9543 

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

◆ __rmod__()

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

Definition at line 9556 of file z3py.py.

9556  def __rmod__(self, other):
9557  """Create the Z3 expression mod `other % self`."""
9558  return fpRem(other, self)
9559 
9560 

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

9490  def __rmul__(self, other):
9491  """Create the Z3 expression `other * self`.
9492 
9493  >>> x = FP('x', FPSort(8, 24))
9494  >>> y = FP('y', FPSort(8, 24))
9495  >>> x * y
9496  x * y
9497  >>> x * 10
9498  x * 1.25*(2**3)
9499  """
9500  [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
9501  return fpMul(_dflt_rm(), a, b, self.ctx)
9502 

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

9465  def __rsub__(self, other):
9466  """Create the Z3 expression `other - self`.
9467 
9468  >>> x = FP('x', FPSort(8, 24))
9469  >>> 10 - x
9470  1.25*(2**3) - x
9471  """
9472  [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
9473  return fpSub(_dflt_rm(), a, b, self.ctx)
9474 
def fpSub(rm, a, b, ctx=None)
Definition: z3py.py:10126

◆ __rtruediv__()

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

Definition at line 9548 of file z3py.py.

9548  def __rtruediv__(self, other):
9549  """Create the Z3 expression division `other / self`."""
9550  return self.__rdiv__(other)
9551 

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

9452  def __sub__(self, other):
9453  """Create the Z3 expression `self - other`.
9454 
9455  >>> x = FP('x', FPSort(8, 24))
9456  >>> y = FP('y', FPSort(8, 24))
9457  >>> x - y
9458  x - y
9459  >>> (x - y).sort()
9460  FPSort(8, 24)
9461  """
9462  [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
9463  return fpSub(_dflt_rm(), a, b, self.ctx)
9464 

◆ __truediv__()

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

Definition at line 9544 of file z3py.py.

9544  def __truediv__(self, other):
9545  """Create the Z3 expression division `self / other`."""
9546  return self.__div__(other)
9547 

◆ as_string()

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

Reimplemented in FPNumRef.

Definition at line 9413 of file z3py.py.

9413  def as_string(self):
9414  """Return a Z3 floating point expression as a Python string."""
9415  return Z3_ast_to_string(self.ctx_ref(), self.as_ast())
9416 
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 9397 of file z3py.py.

9397  def ebits(self):
9398  """Retrieves the number of bits reserved for the exponent in the FloatingPoint expression `self`.
9399  >>> b = FPSort(8, 24)
9400  >>> b.ebits()
9401  8
9402  """
9403  return self.sort().ebits()
9404 

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

9405  def sbits(self):
9406  """Retrieves the number of bits reserved for the exponent in the FloatingPoint expression `self`.
9407  >>> b = FPSort(8, 24)
9408  >>> b.sbits()
9409  24
9410  """
9411  return self.sort().sbits()
9412 

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

9386  def sort(self):
9387  """Return the sort of the floating-point expression `self`.
9388 
9389  >>> x = FP('1.0', FPSort(8, 24))
9390  >>> x.sort()
9391  FPSort(8, 24)
9392  >>> x.sort() == FPSort(8, 24)
9393  True
9394  """
9395  return FPSortRef(Z3_get_sort(self.ctx_ref(), self.as_ast()), self.ctx)
9396 
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().