Z3
Public Member Functions
FPNumRef Class Reference
+ Inheritance diagram for FPNumRef:

Public Member Functions

def sign (self)
 
def sign_as_bv (self)
 
def significand (self)
 
def significand_as_long (self)
 
def significand_as_bv (self)
 
def exponent
 
def exponent_as_long
 
def exponent_as_bv
 
def isNaN (self)
 
def isInf (self)
 
def isZero (self)
 
def isNormal (self)
 
def isSubnormal (self)
 
def isPositive (self)
 
def isNegative (self)
 
def as_string (self)
 
def py_value (self)
 
- Public Member Functions inherited from FPRef
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 kind (self)
 
def num_args (self)
 
def arg (self, idx)
 
def children (self)
 
def update (self, args)
 
def from_string (self, s)
 
def serialize (self)
 
- Public Member Functions inherited from AstRef
def __init__
 
def __del__ (self)
 
def __deepcopy__
 
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)
 
def py_value (self)
 
- Public Member Functions inherited from Z3PPObject
def use_pp (self)
 

Additional Inherited Members

- Data Fields inherited from AstRef
 ast
 
 ctx
 

Detailed Description

The sign of the numeral.

>>> x = FPVal(+1.0, FPSort(8, 24))
>>> x.sign()
False
>>> x = FPVal(-1.0, FPSort(8, 24))
>>> x.sign()
True

Definition at line 10139 of file z3py.py.

Member Function Documentation

def as_string (   self)

Definition at line 10270 of file z3py.py.

10270  def as_string(self):
10271  s = Z3_get_numeral_string(self.ctx.ref(), self.as_ast())
10272  return ("FPVal(%s, %s)" % (s, self.sort()))
10273 
def as_ast(self)
Definition: z3py.py:419
def sort(self)
Definition: z3py.py:1035
Z3_string Z3_API Z3_get_numeral_string(Z3_context c, Z3_ast a)
Return numeral value, as a decimal string of a numeric constant term.
def as_string(self)
Definition: z3py.py:10270
def exponent (   self,
  biased = True 
)

Definition at line 10203 of file z3py.py.

10203  def exponent(self, biased=True):
10204  return Z3_fpa_get_numeral_exponent_string(self.ctx.ref(), self.as_ast(), biased)
10205 
def as_ast(self)
Definition: z3py.py:419
def exponent
Definition: z3py.py:10203
Z3_string Z3_API Z3_fpa_get_numeral_exponent_string(Z3_context c, Z3_ast t, bool biased)
Return the exponent value of a floating-point numeral as a string.
def exponent_as_bv (   self,
  biased = True 
)

Definition at line 10224 of file z3py.py.

10224  def exponent_as_bv(self, biased=True):
10225  return BitVecNumRef(Z3_fpa_get_numeral_exponent_bv(self.ctx.ref(), self.as_ast(), biased), self.ctx)
10226 
def exponent_as_bv
Definition: z3py.py:10224
def as_ast(self)
Definition: z3py.py:419
Z3_ast Z3_API Z3_fpa_get_numeral_exponent_bv(Z3_context c, Z3_ast t, bool biased)
Retrieves the exponent of a floating-point literal as a bit-vector expression.
def exponent_as_long (   self,
  biased = True 
)

Definition at line 10213 of file z3py.py.

10213  def exponent_as_long(self, biased=True):
10214  ptr = (ctypes.c_longlong * 1)()
10215  if not Z3_fpa_get_numeral_exponent_int64(self.ctx.ref(), self.as_ast(), ptr, biased):
10216  raise Z3Exception("error retrieving the exponent of a numeral.")
10217  return ptr[0]
10218 
def as_ast(self)
Definition: z3py.py:419
bool Z3_API Z3_fpa_get_numeral_exponent_int64(Z3_context c, Z3_ast t, int64_t *n, bool biased)
Return the exponent value of a floating-point numeral as a signed 64-bit integer. ...
def exponent_as_long
Definition: z3py.py:10213
def isInf (   self)

Definition at line 10234 of file z3py.py.

10234  def isInf(self):
10235  return Z3_fpa_is_numeral_inf(self.ctx.ref(), self.as_ast())
10236 
def isInf(self)
Definition: z3py.py:10234
def as_ast(self)
Definition: z3py.py:419
bool Z3_API Z3_fpa_is_numeral_inf(Z3_context c, Z3_ast t)
Checks whether a given floating-point numeral is a +oo or -oo.
def isNaN (   self)

Definition at line 10229 of file z3py.py.

10229  def isNaN(self):
10230  return Z3_fpa_is_numeral_nan(self.ctx.ref(), self.as_ast())
10231 
def isNaN(self)
Definition: z3py.py:10229
def as_ast(self)
Definition: z3py.py:419
bool Z3_API Z3_fpa_is_numeral_nan(Z3_context c, Z3_ast t)
Checks whether a given floating-point numeral is a NaN.
def isNegative (   self)

Definition at line 10259 of file z3py.py.

10259  def isNegative(self):
10260  return Z3_fpa_is_numeral_negative(self.ctx.ref(), self.as_ast())
10261 
def as_ast(self)
Definition: z3py.py:419
def isNegative(self)
Definition: z3py.py:10259
bool Z3_API Z3_fpa_is_numeral_negative(Z3_context c, Z3_ast t)
Checks whether a given floating-point numeral is negative.
def isNormal (   self)

Definition at line 10244 of file z3py.py.

10244  def isNormal(self):
10245  return Z3_fpa_is_numeral_normal(self.ctx.ref(), self.as_ast())
10246 
def as_ast(self)
Definition: z3py.py:419
bool Z3_API Z3_fpa_is_numeral_normal(Z3_context c, Z3_ast t)
Checks whether a given floating-point numeral is normal.
def isNormal(self)
Definition: z3py.py:10244
def isPositive (   self)

Definition at line 10254 of file z3py.py.

10254  def isPositive(self):
10255  return Z3_fpa_is_numeral_positive(self.ctx.ref(), self.as_ast())
10256 
def as_ast(self)
Definition: z3py.py:419
def isPositive(self)
Definition: z3py.py:10254
bool Z3_API Z3_fpa_is_numeral_positive(Z3_context c, Z3_ast t)
Checks whether a given floating-point numeral is positive.
def isSubnormal (   self)

Definition at line 10249 of file z3py.py.

10249  def isSubnormal(self):
10250  return Z3_fpa_is_numeral_subnormal(self.ctx.ref(), self.as_ast())
10251 
def as_ast(self)
Definition: z3py.py:419
bool Z3_API Z3_fpa_is_numeral_subnormal(Z3_context c, Z3_ast t)
Checks whether a given floating-point numeral is subnormal.
def isSubnormal(self)
Definition: z3py.py:10249
def isZero (   self)

Definition at line 10239 of file z3py.py.

10239  def isZero(self):
10240  return Z3_fpa_is_numeral_zero(self.ctx.ref(), self.as_ast())
10241 
def as_ast(self)
Definition: z3py.py:419
def isZero(self)
Definition: z3py.py:10239
bool Z3_API Z3_fpa_is_numeral_zero(Z3_context c, Z3_ast t)
Checks whether a given floating-point numeral is +zero or -zero.
def py_value (   self)

Definition at line 10274 of file z3py.py.

10274  def py_value(self):
10275  bv = simplify(fpToIEEEBV(self))
10276  binary = bv.py_value()
10277  if not isinstance(binary, int):
10278  return None
10279  # Decode the IEEE 754 binary representation
10280  import struct
10281  bytes_rep = binary.to_bytes(8, byteorder='big')
10282  return struct.unpack('>d', bytes_rep)[0]
10283 
10284 
def simplify(a, arguments, keywords)
Utils.
Definition: z3py.py:9174
def py_value(self)
Definition: z3py.py:10274
def fpToIEEEBV
Definition: z3py.py:11106
def sign (   self)

Definition at line 10150 of file z3py.py.

10150  def sign(self):
10151  num = ctypes.c_bool()
10152  nsign = Z3_fpa_get_numeral_sign(self.ctx.ref(), self.as_ast(), byref(num))
10153  if nsign is False:
10154  raise Z3Exception("error retrieving the sign of a numeral.")
10155  return num.value != 0
10156 
bool Z3_API Z3_fpa_get_numeral_sign(Z3_context c, Z3_ast t, bool *sgn)
Retrieves the sign of a floating-point literal.
def as_ast(self)
Definition: z3py.py:419
def sign(self)
Definition: z3py.py:10150
def sign_as_bv (   self)

Definition at line 10162 of file z3py.py.

10162  def sign_as_bv(self):
10163  return BitVecNumRef(Z3_fpa_get_numeral_sign_bv(self.ctx.ref(), self.as_ast()), self.ctx)
10164 
def sign_as_bv(self)
Definition: z3py.py:10162
def as_ast(self)
Definition: z3py.py:419
Z3_ast Z3_API Z3_fpa_get_numeral_sign_bv(Z3_context c, Z3_ast t)
Retrieves the sign of a floating-point literal as a bit-vector expression.
def significand (   self)

Definition at line 10172 of file z3py.py.

10172  def significand(self):
10173  return Z3_fpa_get_numeral_significand_string(self.ctx.ref(), self.as_ast())
10174 
def as_ast(self)
Definition: z3py.py:419
Z3_string Z3_API Z3_fpa_get_numeral_significand_string(Z3_context c, Z3_ast t)
Return the significand value of a floating-point numeral as a string.
def significand(self)
Definition: z3py.py:10172
def significand_as_bv (   self)

Definition at line 10193 of file z3py.py.

10194  return BitVecNumRef(Z3_fpa_get_numeral_significand_bv(self.ctx.ref(), self.as_ast()), self.ctx)
10195 
def as_ast(self)
Definition: z3py.py:419
def significand_as_bv(self)
Definition: z3py.py:10193
Z3_ast Z3_API Z3_fpa_get_numeral_significand_bv(Z3_context c, Z3_ast t)
Retrieves the significand of a floating-point literal as a bit-vector expression. ...
def significand_as_long (   self)

Definition at line 10182 of file z3py.py.

10183  ptr = (ctypes.c_ulonglong * 1)()
10184  if not Z3_fpa_get_numeral_significand_uint64(self.ctx.ref(), self.as_ast(), ptr):
10185  raise Z3Exception("error retrieving the significand of a numeral.")
10186  return ptr[0]
10187 
def significand_as_long(self)
Definition: z3py.py:10182
def as_ast(self)
Definition: z3py.py:419
bool Z3_API Z3_fpa_get_numeral_significand_uint64(Z3_context c, Z3_ast t, uint64_t *n)
Return the significand value of a floating-point numeral as a uint64.