Z3
Public Member Functions | Data Fields
FPSortRef Class Reference

FP Sorts. More...

+ Inheritance diagram for FPSortRef:

Public Member Functions

def ebits (self)
 
def sbits (self)
 
def cast (self, val)
 
- Public Member Functions inherited from SortRef
def as_ast (self)
 
def get_id (self)
 
def kind (self)
 
def subsort (self, other)
 
def name (self)
 
def __eq__ (self, other)
 
def __ne__ (self, other)
 
def __hash__ (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)
 

Data Fields

 ctx
 
- Data Fields inherited from AstRef
 ast
 
 ctx
 

Detailed Description

FP Sorts.

Floating-point sort.

Definition at line 8736 of file z3py.py.

Member Function Documentation

◆ cast()

def cast (   self,
  val 
)
Try to cast `val` as a floating-point expression.
>>> b = FPSort(8, 24)
>>> b.cast(1.0)
1
>>> b.cast(1.0).sexpr()
'(fp #b0 #x7f #b00000000000000000000000)'

Reimplemented from SortRef.

Definition at line 8755 of file z3py.py.

8755  def cast(self, val):
8756  """Try to cast `val` as a floating-point expression.
8757  >>> b = FPSort(8, 24)
8758  >>> b.cast(1.0)
8759  1
8760  >>> b.cast(1.0).sexpr()
8761  '(fp #b0 #x7f #b00000000000000000000000)'
8762  """
8763  if is_expr(val):
8764  if z3_debug():
8765  _z3_assert(self.ctx == val.ctx, "Context mismatch")
8766  return val
8767  else:
8768  return FPVal(val, None, self, self.ctx)
8769 
8770 

◆ ebits()

def ebits (   self)
Retrieves the number of bits reserved for the exponent in the FloatingPoint sort `self`.
>>> b = FPSort(8, 24)
>>> b.ebits()
8

Definition at line 8739 of file z3py.py.

8739  def ebits(self):
8740  """Retrieves the number of bits reserved for the exponent in the FloatingPoint sort `self`.
8741  >>> b = FPSort(8, 24)
8742  >>> b.ebits()
8743  8
8744  """
8745  return int(Z3_fpa_get_ebits(self.ctx_ref(), self.ast))
8746 

◆ sbits()

def sbits (   self)
Retrieves the number of bits reserved for the significand in the FloatingPoint sort `self`.
>>> b = FPSort(8, 24)
>>> b.sbits()
24

Definition at line 8747 of file z3py.py.

8747  def sbits(self):
8748  """Retrieves the number of bits reserved for the significand in the FloatingPoint sort `self`.
8749  >>> b = FPSort(8, 24)
8750  >>> b.sbits()
8751  24
8752  """
8753  return int(Z3_fpa_get_sbits(self.ctx_ref(), self.ast))
8754 

Field Documentation

◆ ctx

ctx

Definition at line 8765 of file z3py.py.

Referenced by UserPropagateBase.conflict(), and UserPropagateBase.ctx_ref().

z3py.FPVal
def FPVal(sig, exp=None, fps=None, ctx=None)
Definition: z3py.py:9342
Z3_fpa_get_sbits
unsigned Z3_API Z3_fpa_get_sbits(Z3_context c, Z3_sort s)
Retrieves the number of bits reserved for the significand in a FloatingPoint sort.
z3py.z3_debug
def z3_debug()
Definition: z3py.py:56
Z3_fpa_get_ebits
unsigned Z3_API Z3_fpa_get_ebits(Z3_context c, Z3_sort s)
Retrieves the number of bits reserved for the exponent in a FloatingPoint sort.
z3py.is_expr
def is_expr(a)
Definition: z3py.py:1135