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)
 
- 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 9345 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 9391 of file z3py.py.

9391  def __add__(self, other):
9392  """Create the Z3 expression `self + other`.
9393 
9394  >>> x = FP('x', FPSort(8, 24))
9395  >>> y = FP('y', FPSort(8, 24))
9396  >>> x + y
9397  x + y
9398  >>> (x + y).sort()
9399  FPSort(8, 24)
9400  """
9401  [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
9402  return fpAdd(_dflt_rm(), a, b, self.ctx)
9403 
def fpAdd(rm, a, b, ctx=None)
Definition: z3py.py:10071

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

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

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

◆ __ge__()

def __ge__ (   self,
  other 
)

Definition at line 9385 of file z3py.py.

9385  def __ge__(self, other):
9386  return fpGEQ(self, other, self.ctx)
9387 
def fpGEQ(a, b, ctx=None)
Definition: z3py.py:10289

◆ __gt__()

def __gt__ (   self,
  other 
)

Definition at line 9388 of file z3py.py.

9388  def __gt__(self, other):
9389  return fpGT(self, other, self.ctx)
9390 
def fpGT(a, b, ctx=None)
Definition: z3py.py:10277

◆ __le__()

def __le__ (   self,
  other 
)

Definition at line 9379 of file z3py.py.

9379  def __le__(self, other):
9380  return fpLEQ(self, other, self.ctx)
9381 
def fpLEQ(a, b, ctx=None)
Definition: z3py.py:10265

◆ __lt__()

def __lt__ (   self,
  other 
)

Definition at line 9382 of file z3py.py.

9382  def __lt__(self, other):
9383  return fpLT(self, other, self.ctx)
9384 
def fpLT(a, b, ctx=None)
Definition: z3py.py:10253

◆ __mod__()

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

Definition at line 9514 of file z3py.py.

9514  def __mod__(self, other):
9515  """Create the Z3 expression mod `self % other`."""
9516  return fpRem(self, other)
9517 
def fpRem(a, b, ctx=None)
Definition: z3py.py:10133

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

9437  def __mul__(self, other):
9438  """Create the Z3 expression `self * other`.
9439 
9440  >>> x = FP('x', FPSort(8, 24))
9441  >>> y = FP('y', FPSort(8, 24))
9442  >>> x * y
9443  x * y
9444  >>> (x * y).sort()
9445  FPSort(8, 24)
9446  >>> 10 * y
9447  1.25*(2**3) * y
9448  """
9449  [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
9450  return fpMul(_dflt_rm(), a, b, self.ctx)
9451 
def fpMul(rm, a, b, ctx=None)
Definition: z3py.py:10103

◆ __neg__()

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

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

Definition at line 9469 of file z3py.py.

9469  def __neg__(self):
9470  """Create the Z3 expression `-self`.
9471 
9472  >>> x = FP('x', Float32())
9473  >>> -x
9474  -x
9475  """
9476  return fpNeg(self)
9477 
def fpNeg(a, ctx=None)
Definition: z3py.py:10003

◆ __pos__()

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

Definition at line 9465 of file z3py.py.

9465  def __pos__(self):
9466  """Create the Z3 expression `+self`."""
9467  return self
9468 

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

9404  def __radd__(self, other):
9405  """Create the Z3 expression `other + self`.
9406 
9407  >>> x = FP('x', FPSort(8, 24))
9408  >>> 10 + x
9409  1.25*(2**3) + x
9410  """
9411  [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
9412  return fpAdd(_dflt_rm(), a, b, self.ctx)
9413 

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

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

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

◆ __rmod__()

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

Definition at line 9518 of file z3py.py.

9518  def __rmod__(self, other):
9519  """Create the Z3 expression mod `other % self`."""
9520  return fpRem(other, self)
9521 
9522 

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

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

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

9427  def __rsub__(self, other):
9428  """Create the Z3 expression `other - self`.
9429 
9430  >>> x = FP('x', FPSort(8, 24))
9431  >>> 10 - x
9432  1.25*(2**3) - x
9433  """
9434  [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
9435  return fpSub(_dflt_rm(), a, b, self.ctx)
9436 
def fpSub(rm, a, b, ctx=None)
Definition: z3py.py:10088

◆ __rtruediv__()

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

Definition at line 9510 of file z3py.py.

9510  def __rtruediv__(self, other):
9511  """Create the Z3 expression division `other / self`."""
9512  return self.__rdiv__(other)
9513 

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

9414  def __sub__(self, other):
9415  """Create the Z3 expression `self - other`.
9416 
9417  >>> x = FP('x', FPSort(8, 24))
9418  >>> y = FP('y', FPSort(8, 24))
9419  >>> x - y
9420  x - y
9421  >>> (x - y).sort()
9422  FPSort(8, 24)
9423  """
9424  [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
9425  return fpSub(_dflt_rm(), a, b, self.ctx)
9426 

◆ __truediv__()

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

Definition at line 9506 of file z3py.py.

9506  def __truediv__(self, other):
9507  """Create the Z3 expression division `self / other`."""
9508  return self.__div__(other)
9509 

◆ as_string()

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

Reimplemented in FPNumRef.

Definition at line 9375 of file z3py.py.

9375  def as_string(self):
9376  """Return a Z3 floating point expression as a Python string."""
9377  return Z3_ast_to_string(self.ctx_ref(), self.as_ast())
9378 
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 9359 of file z3py.py.

9359  def ebits(self):
9360  """Retrieves the number of bits reserved for the exponent in the FloatingPoint expression `self`.
9361  >>> b = FPSort(8, 24)
9362  >>> b.ebits()
9363  8
9364  """
9365  return self.sort().ebits()
9366 

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

9367  def sbits(self):
9368  """Retrieves the number of bits reserved for the exponent in the FloatingPoint expression `self`.
9369  >>> b = FPSort(8, 24)
9370  >>> b.sbits()
9371  24
9372  """
9373  return self.sort().sbits()
9374 

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

9348  def sort(self):
9349  """Return the sort of the floating-point expression `self`.
9350 
9351  >>> x = FP('1.0', FPSort(8, 24))
9352  >>> x.sort()
9353  FPSort(8, 24)
9354  >>> x.sort() == FPSort(8, 24)
9355  True
9356  """
9357  return FPSortRef(Z3_get_sort(self.ctx_ref(), self.as_ast()), self.ctx)
9358 
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().