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 8696 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 8715 of file z3py.py.

8715  def cast(self, val):
8716  """Try to cast `val` as a floating-point expression.
8717  >>> b = FPSort(8, 24)
8718  >>> b.cast(1.0)
8719  1
8720  >>> b.cast(1.0).sexpr()
8721  '(fp #b0 #x7f #b00000000000000000000000)'
8722  """
8723  if is_expr(val):
8724  if z3_debug():
8725  _z3_assert(self.ctx == val.ctx, "Context mismatch")
8726  return val
8727  else:
8728  return FPVal(val, None, self, self.ctx)
8729 
8730 
def FPVal(sig, exp=None, fps=None, ctx=None)
Definition: z3py.py:9302
def z3_debug()
Definition: z3py.py:58
def is_expr(a)
Definition: z3py.py:1117

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

8699  def ebits(self):
8700  """Retrieves the number of bits reserved for the exponent in the FloatingPoint sort `self`.
8701  >>> b = FPSort(8, 24)
8702  >>> b.ebits()
8703  8
8704  """
8705  return int(Z3_fpa_get_ebits(self.ctx_ref(), self.ast))
8706 
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.

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

8707  def sbits(self):
8708  """Retrieves the number of bits reserved for the significand in the FloatingPoint sort `self`.
8709  >>> b = FPSort(8, 24)
8710  >>> b.sbits()
8711  24
8712  """
8713  return int(Z3_fpa_get_sbits(self.ctx_ref(), self.ast))
8714 
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.

Field Documentation

◆ ctx

ctx

Definition at line 8725 of file z3py.py.