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_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

FP Expressions.

Floating-point expressions.

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

8898  def __add__(self, other):
8899  """Create the Z3 expression `self + other`.
8900 
8901  >>> x = FP('x', FPSort(8, 24))
8902  >>> y = FP('y', FPSort(8, 24))
8903  >>> x + y
8904  x + y
8905  >>> (x + y).sort()
8906  FPSort(8, 24)
8907  """
8908  [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
8909  return fpAdd(_dflt_rm(), a, b, self.ctx)
8910 

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

8985  def __div__(self, other):
8986  """Create the Z3 expression `self / other`.
8987 
8988  >>> x = FP('x', FPSort(8, 24))
8989  >>> y = FP('y', FPSort(8, 24))
8990  >>> x / y
8991  x / y
8992  >>> (x / y).sort()
8993  FPSort(8, 24)
8994  >>> 10 / y
8995  1.25*(2**3) / y
8996  """
8997  [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
8998  return fpDiv(_dflt_rm(), a, b, self.ctx)
8999 

Referenced by FPRef.__truediv__().

◆ __ge__()

def __ge__ (   self,
  other 
)

Definition at line 8892 of file z3py.py.

8892  def __ge__(self, other):
8893  return fpGEQ(self, other, self.ctx)
8894 

◆ __gt__()

def __gt__ (   self,
  other 
)

Definition at line 8895 of file z3py.py.

8895  def __gt__(self, other):
8896  return fpGT(self, other, self.ctx)
8897 

◆ __le__()

def __le__ (   self,
  other 
)

Definition at line 8886 of file z3py.py.

8886  def __le__(self, other):
8887  return fpLEQ(self, other, self.ctx)
8888 

◆ __lt__()

def __lt__ (   self,
  other 
)

Definition at line 8889 of file z3py.py.

8889  def __lt__(self, other):
8890  return fpLT(self, other, self.ctx)
8891 

◆ __mod__()

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

Definition at line 9021 of file z3py.py.

9021  def __mod__(self, other):
9022  """Create the Z3 expression mod `self % other`."""
9023  return fpRem(self, other)
9024 

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

8944  def __mul__(self, other):
8945  """Create the Z3 expression `self * other`.
8946 
8947  >>> x = FP('x', FPSort(8, 24))
8948  >>> y = FP('y', FPSort(8, 24))
8949  >>> x * y
8950  x * y
8951  >>> (x * y).sort()
8952  FPSort(8, 24)
8953  >>> 10 * y
8954  1.25*(2**3) * y
8955  """
8956  [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
8957  return fpMul(_dflt_rm(), a, b, self.ctx)
8958 

◆ __neg__()

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

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

Definition at line 8976 of file z3py.py.

8976  def __neg__(self):
8977  """Create the Z3 expression `-self`.
8978 
8979  >>> x = FP('x', Float32())
8980  >>> -x
8981  -x
8982  """
8983  return fpNeg(self)
8984 

◆ __pos__()

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

Definition at line 8972 of file z3py.py.

8972  def __pos__(self):
8973  """Create the Z3 expression `+self`."""
8974  return self
8975 

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

8911  def __radd__(self, other):
8912  """Create the Z3 expression `other + self`.
8913 
8914  >>> x = FP('x', FPSort(8, 24))
8915  >>> 10 + x
8916  1.25*(2**3) + x
8917  """
8918  [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
8919  return fpAdd(_dflt_rm(), a, b, self.ctx)
8920 

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

9000  def __rdiv__(self, other):
9001  """Create the Z3 expression `other / self`.
9002 
9003  >>> x = FP('x', FPSort(8, 24))
9004  >>> y = FP('y', FPSort(8, 24))
9005  >>> x / y
9006  x / y
9007  >>> x / 10
9008  x / 1.25*(2**3)
9009  """
9010  [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
9011  return fpDiv(_dflt_rm(), a, b, self.ctx)
9012 

Referenced by FPRef.__rtruediv__().

◆ __rmod__()

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

Definition at line 9025 of file z3py.py.

9025  def __rmod__(self, other):
9026  """Create the Z3 expression mod `other % self`."""
9027  return fpRem(other, self)
9028 

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

8959  def __rmul__(self, other):
8960  """Create the Z3 expression `other * self`.
8961 
8962  >>> x = FP('x', FPSort(8, 24))
8963  >>> y = FP('y', FPSort(8, 24))
8964  >>> x * y
8965  x * y
8966  >>> x * 10
8967  x * 1.25*(2**3)
8968  """
8969  [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
8970  return fpMul(_dflt_rm(), a, b, self.ctx)
8971 

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

8934  def __rsub__(self, other):
8935  """Create the Z3 expression `other - self`.
8936 
8937  >>> x = FP('x', FPSort(8, 24))
8938  >>> 10 - x
8939  1.25*(2**3) - x
8940  """
8941  [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
8942  return fpSub(_dflt_rm(), a, b, self.ctx)
8943 

◆ __rtruediv__()

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

Definition at line 9017 of file z3py.py.

9017  def __rtruediv__(self, other):
9018  """Create the Z3 expression division `other / self`."""
9019  return self.__rdiv__(other)
9020 

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

8921  def __sub__(self, other):
8922  """Create the Z3 expression `self - other`.
8923 
8924  >>> x = FP('x', FPSort(8, 24))
8925  >>> y = FP('y', FPSort(8, 24))
8926  >>> x - y
8927  x - y
8928  >>> (x - y).sort()
8929  FPSort(8, 24)
8930  """
8931  [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
8932  return fpSub(_dflt_rm(), a, b, self.ctx)
8933 

◆ __truediv__()

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

Definition at line 9013 of file z3py.py.

9013  def __truediv__(self, other):
9014  """Create the Z3 expression division `self / other`."""
9015  return self.__div__(other)
9016 

◆ as_string()

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

Reimplemented in FPNumRef.

Definition at line 8882 of file z3py.py.

8882  def as_string(self):
8883  """Return a Z3 floating point expression as a Python string."""
8884  return Z3_ast_to_string(self.ctx_ref(), self.as_ast())
8885 

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

8866  def ebits(self):
8867  """Retrieves the number of bits reserved for the exponent in the FloatingPoint expression `self`.
8868  >>> b = FPSort(8, 24)
8869  >>> b.ebits()
8870  8
8871  """
8872  return self.sort().ebits();
8873 

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

8874  def sbits(self):
8875  """Retrieves the number of bits reserved for the exponent in the FloatingPoint expression `self`.
8876  >>> b = FPSort(8, 24)
8877  >>> b.sbits()
8878  24
8879  """
8880  return self.sort().sbits();
8881 

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

8855  def sort(self):
8856  """Return the sort of the floating-point expression `self`.
8857 
8858  >>> x = FP('1.0', FPSort(8, 24))
8859  >>> x.sort()
8860  FPSort(8, 24)
8861  >>> x.sort() == FPSort(8, 24)
8862  True
8863  """
8864  return FPSortRef(Z3_get_sort(self.ctx_ref(), self.as_ast()), self.ctx)
8865 
z3py.fpLT
def fpLT(a, b, ctx=None)
Definition: z3py.py:9688
z3py.fpGT
def fpGT(a, b, ctx=None)
Definition: z3py.py:9710
z3py.fpMul
def fpMul(rm, a, b, ctx=None)
Definition: z3py.py:9554
z3py.fpGEQ
def fpGEQ(a, b, ctx=None)
Definition: z3py.py:9721
z3py.fpRem
def fpRem(a, b, ctx=None)
Definition: z3py.py:9582
Z3_ast_to_string
Z3_string Z3_API Z3_ast_to_string(Z3_context c, Z3_ast a)
Convert the given AST node into a string.
z3py.fpDiv
def fpDiv(rm, a, b, ctx=None)
Definition: z3py.py:9568
z3py.fpAdd
def fpAdd(rm, a, b, ctx=None)
Definition: z3py.py:9524
z3py.fpSub
def fpSub(rm, a, b, ctx=None)
Definition: z3py.py:9540
z3py.fpNeg
def fpNeg(a, ctx=None)
Definition: z3py.py:9464
z3py.fpLEQ
def fpLEQ(a, b, ctx=None)
Definition: z3py.py:9699
Z3_get_sort
Z3_sort Z3_API Z3_get_sort(Z3_context c, Z3_ast a)
Return the sort of an AST node.