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 (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 __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 __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 9455 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 9501 of file z3py.py.

9501 def __add__(self, other):
9502 """Create the Z3 expression `self + other`.
9503
9504 >>> x = FP('x', FPSort(8, 24))
9505 >>> y = FP('y', FPSort(8, 24))
9506 >>> x + y
9507 x + y
9508 >>> (x + y).sort()
9509 FPSort(8, 24)
9510 """
9511 [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
9512 return fpAdd(_dflt_rm(), a, b, self.ctx)
9513
def fpAdd(rm, a, b, ctx=None)
Definition: z3py.py:10181
def FP(name, fpsort, ctx=None)
Definition: z3py.py:10047
def FPSort(ebits, sbits, ctx=None)
Definition: z3py.py:9876

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

9588 def __div__(self, other):
9589 """Create the Z3 expression `self / other`.
9590
9591 >>> x = FP('x', FPSort(8, 24))
9592 >>> y = FP('y', FPSort(8, 24))
9593 >>> x / y
9594 x / y
9595 >>> (x / y).sort()
9596 FPSort(8, 24)
9597 >>> 10 / y
9598 1.25*(2**3) / y
9599 """
9600 [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
9601 return fpDiv(_dflt_rm(), a, b, self.ctx)
9602
def fpDiv(rm, a, b, ctx=None)
Definition: z3py.py:10228

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

◆ __ge__()

def __ge__ (   self,
  other 
)

Definition at line 9495 of file z3py.py.

9495 def __ge__(self, other):
9496 return fpGEQ(self, other, self.ctx)
9497
def fpGEQ(a, b, ctx=None)
Definition: z3py.py:10399

◆ __gt__()

def __gt__ (   self,
  other 
)

Definition at line 9498 of file z3py.py.

9498 def __gt__(self, other):
9499 return fpGT(self, other, self.ctx)
9500
def fpGT(a, b, ctx=None)
Definition: z3py.py:10387

◆ __le__()

def __le__ (   self,
  other 
)

Definition at line 9489 of file z3py.py.

9489 def __le__(self, other):
9490 return fpLEQ(self, other, self.ctx)
9491
def fpLEQ(a, b, ctx=None)
Definition: z3py.py:10375

◆ __lt__()

def __lt__ (   self,
  other 
)

Definition at line 9492 of file z3py.py.

9492 def __lt__(self, other):
9493 return fpLT(self, other, self.ctx)
9494
def fpLT(a, b, ctx=None)
Definition: z3py.py:10363

◆ __mod__()

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

Definition at line 9624 of file z3py.py.

9624 def __mod__(self, other):
9625 """Create the Z3 expression mod `self % other`."""
9626 return fpRem(self, other)
9627
def fpRem(a, b, ctx=None)
Definition: z3py.py:10243

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

9547 def __mul__(self, other):
9548 """Create the Z3 expression `self * other`.
9549
9550 >>> x = FP('x', FPSort(8, 24))
9551 >>> y = FP('y', FPSort(8, 24))
9552 >>> x * y
9553 x * y
9554 >>> (x * y).sort()
9555 FPSort(8, 24)
9556 >>> 10 * y
9557 1.25*(2**3) * y
9558 """
9559 [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
9560 return fpMul(_dflt_rm(), a, b, self.ctx)
9561
def fpMul(rm, a, b, ctx=None)
Definition: z3py.py:10213

◆ __neg__()

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

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

Definition at line 9579 of file z3py.py.

9579 def __neg__(self):
9580 """Create the Z3 expression `-self`.
9581
9582 >>> x = FP('x', Float32())
9583 >>> -x
9584 -x
9585 """
9586 return fpNeg(self)
9587
def fpNeg(a, ctx=None)
Definition: z3py.py:10113
def Float32(ctx=None)
Definition: z3py.py:9391

◆ __pos__()

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

Definition at line 9575 of file z3py.py.

9575 def __pos__(self):
9576 """Create the Z3 expression `+self`."""
9577 return self
9578

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

9514 def __radd__(self, other):
9515 """Create the Z3 expression `other + self`.
9516
9517 >>> x = FP('x', FPSort(8, 24))
9518 >>> 10 + x
9519 1.25*(2**3) + x
9520 """
9521 [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
9522 return fpAdd(_dflt_rm(), a, b, self.ctx)
9523

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

9603 def __rdiv__(self, other):
9604 """Create the Z3 expression `other / self`.
9605
9606 >>> x = FP('x', FPSort(8, 24))
9607 >>> y = FP('y', FPSort(8, 24))
9608 >>> x / y
9609 x / y
9610 >>> x / 10
9611 x / 1.25*(2**3)
9612 """
9613 [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
9614 return fpDiv(_dflt_rm(), a, b, self.ctx)
9615

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

◆ __rmod__()

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

Definition at line 9628 of file z3py.py.

9628 def __rmod__(self, other):
9629 """Create the Z3 expression mod `other % self`."""
9630 return fpRem(other, self)
9631
9632

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

9562 def __rmul__(self, other):
9563 """Create the Z3 expression `other * self`.
9564
9565 >>> x = FP('x', FPSort(8, 24))
9566 >>> y = FP('y', FPSort(8, 24))
9567 >>> x * y
9568 x * y
9569 >>> x * 10
9570 x * 1.25*(2**3)
9571 """
9572 [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
9573 return fpMul(_dflt_rm(), a, b, self.ctx)
9574

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

9537 def __rsub__(self, other):
9538 """Create the Z3 expression `other - self`.
9539
9540 >>> x = FP('x', FPSort(8, 24))
9541 >>> 10 - x
9542 1.25*(2**3) - x
9543 """
9544 [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
9545 return fpSub(_dflt_rm(), a, b, self.ctx)
9546
def fpSub(rm, a, b, ctx=None)
Definition: z3py.py:10198

◆ __rtruediv__()

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

Definition at line 9620 of file z3py.py.

9620 def __rtruediv__(self, other):
9621 """Create the Z3 expression division `other / self`."""
9622 return self.__rdiv__(other)
9623

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

9524 def __sub__(self, other):
9525 """Create the Z3 expression `self - other`.
9526
9527 >>> x = FP('x', FPSort(8, 24))
9528 >>> y = FP('y', FPSort(8, 24))
9529 >>> x - y
9530 x - y
9531 >>> (x - y).sort()
9532 FPSort(8, 24)
9533 """
9534 [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
9535 return fpSub(_dflt_rm(), a, b, self.ctx)
9536

◆ __truediv__()

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

Definition at line 9616 of file z3py.py.

9616 def __truediv__(self, other):
9617 """Create the Z3 expression division `self / other`."""
9618 return self.__div__(other)
9619

◆ as_string()

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

Reimplemented in FPNumRef.

Definition at line 9485 of file z3py.py.

9485 def as_string(self):
9486 """Return a Z3 floating point expression as a Python string."""
9487 return Z3_ast_to_string(self.ctx_ref(), self.as_ast())
9488
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 9469 of file z3py.py.

9469 def ebits(self):
9470 """Retrieves the number of bits reserved for the exponent in the FloatingPoint expression `self`.
9471 >>> b = FPSort(8, 24)
9472 >>> b.ebits()
9473 8
9474 """
9475 return self.sort().ebits()
9476

Referenced by FPRef.ebits().

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

9477 def sbits(self):
9478 """Retrieves the number of bits reserved for the exponent in the FloatingPoint expression `self`.
9479 >>> b = FPSort(8, 24)
9480 >>> b.sbits()
9481 24
9482 """
9483 return self.sort().sbits()
9484

Referenced by FPRef.sbits().

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

9458 def sort(self):
9459 """Return the sort of the floating-point expression `self`.
9460
9461 >>> x = FP('1.0', FPSort(8, 24))
9462 >>> x.sort()
9463 FPSort(8, 24)
9464 >>> x.sort() == FPSort(8, 24)
9465 True
9466 """
9467 return FPSortRef(Z3_get_sort(self.ctx_ref(), self.as_ast()), self.ctx)
9468
Z3_sort Z3_API Z3_get_sort(Z3_context c, Z3_ast a)
Return the sort of an AST node.

Referenced by FPRef.__add__(), FPRef.__div__(), FPRef.__mul__(), FPRef.__sub__(), 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().