Z3
 
Loading...
Searching...
No Matches
FPNumRef Class Reference
+ Inheritance diagram for FPNumRef:

Public Member Functions

 sign (self)
 
 sign_as_bv (self)
 
 significand (self)
 
 significand_as_long (self)
 
 significand_as_bv (self)
 
 exponent (self, biased=True)
 
 exponent_as_long (self, biased=True)
 
 exponent_as_bv (self, biased=True)
 
 isNaN (self)
 
 isInf (self)
 
 isZero (self)
 
 isNormal (self)
 
 isSubnormal (self)
 
 isPositive (self)
 
 isNegative (self)
 
 as_string (self)
 
- Public Member Functions inherited from FPRef
 sort (self)
 
 ebits (self)
 
 sbits (self)
 
 __le__ (self, other)
 
 __lt__ (self, other)
 
 __ge__ (self, other)
 
 __gt__ (self, other)
 
 __add__ (self, other)
 
 __radd__ (self, other)
 
 __sub__ (self, other)
 
 __rsub__ (self, other)
 
 __mul__ (self, other)
 
 __rmul__ (self, other)
 
 __pos__ (self)
 
 __neg__ (self)
 
 __div__ (self, other)
 
 __rdiv__ (self, other)
 
 __truediv__ (self, other)
 
 __rtruediv__ (self, other)
 
 __mod__ (self, other)
 
 __rmod__ (self, other)
 
- Public Member Functions inherited from ExprRef
 as_ast (self)
 
 get_id (self)
 
 sort_kind (self)
 
 __eq__ (self, other)
 
 __hash__ (self)
 
 __ne__ (self, other)
 
 params (self)
 
 decl (self)
 
 kind (self)
 
 num_args (self)
 
 arg (self, idx)
 
 children (self)
 
 from_string (self, s)
 
 serialize (self)
 
- Public Member Functions inherited from AstRef
 __init__ (self, ast, ctx=None)
 
 __del__ (self)
 
 __deepcopy__ (self, memo={})
 
 __str__ (self)
 
 __repr__ (self)
 
 __eq__ (self, other)
 
 __hash__ (self)
 
 __nonzero__ (self)
 
 __bool__ (self)
 
 sexpr (self)
 
 ctx_ref (self)
 
 eq (self, other)
 
 translate (self, target)
 
 __copy__ (self)
 
 hash (self)
 
- Public Member Functions inherited from Z3PPObject
 use_pp (self)
 

Additional Inherited Members

- Data Fields inherited from AstRef
 ast = ast
 
 ctx = _get_ctx(ctx)
 
- Protected Member Functions inherited from Z3PPObject
 _repr_html_ (self)
 

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

Member Function Documentation

◆ as_string()

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

Reimplemented from FPRef.

Definition at line 10047 of file z3py.py.

10047 def as_string(self):
10048 s = Z3_get_numeral_string(self.ctx.ref(), self.as_ast())
10049 return ("FPVal(%s, %s)" % (s, self.sort()))
10050
10051
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.

◆ exponent()

exponent ( self,
biased = True )

Definition at line 9980 of file z3py.py.

9980 def exponent(self, biased=True):
9981 return Z3_fpa_get_numeral_exponent_string(self.ctx.ref(), self.as_ast(), biased)
9982
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.

◆ exponent_as_bv()

exponent_as_bv ( self,
biased = True )

Definition at line 10001 of file z3py.py.

10001 def exponent_as_bv(self, biased=True):
10002 return BitVecNumRef(Z3_fpa_get_numeral_exponent_bv(self.ctx.ref(), self.as_ast(), biased), self.ctx)
10003
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.

◆ exponent_as_long()

exponent_as_long ( self,
biased = True )

Definition at line 9990 of file z3py.py.

9990 def exponent_as_long(self, biased=True):
9991 ptr = (ctypes.c_longlong * 1)()
9992 if not Z3_fpa_get_numeral_exponent_int64(self.ctx.ref(), self.as_ast(), ptr, biased):
9993 raise Z3Exception("error retrieving the exponent of a numeral.")
9994 return ptr[0]
9995
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.

◆ isInf()

isInf ( self)

Definition at line 10011 of file z3py.py.

10011 def isInf(self):
10012 return Z3_fpa_is_numeral_inf(self.ctx.ref(), self.as_ast())
10013
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.

◆ isNaN()

isNaN ( self)

Definition at line 10006 of file z3py.py.

10006 def isNaN(self):
10007 return Z3_fpa_is_numeral_nan(self.ctx.ref(), self.as_ast())
10008
bool Z3_API Z3_fpa_is_numeral_nan(Z3_context c, Z3_ast t)
Checks whether a given floating-point numeral is a NaN.

◆ isNegative()

isNegative ( self)

Definition at line 10036 of file z3py.py.

10036 def isNegative(self):
10037 return Z3_fpa_is_numeral_negative(self.ctx.ref(), self.as_ast())
10038
bool Z3_API Z3_fpa_is_numeral_negative(Z3_context c, Z3_ast t)
Checks whether a given floating-point numeral is negative.

◆ isNormal()

isNormal ( self)

Definition at line 10021 of file z3py.py.

10021 def isNormal(self):
10022 return Z3_fpa_is_numeral_normal(self.ctx.ref(), self.as_ast())
10023
bool Z3_API Z3_fpa_is_numeral_normal(Z3_context c, Z3_ast t)
Checks whether a given floating-point numeral is normal.

◆ isPositive()

isPositive ( self)

Definition at line 10031 of file z3py.py.

10031 def isPositive(self):
10032 return Z3_fpa_is_numeral_positive(self.ctx.ref(), self.as_ast())
10033
bool Z3_API Z3_fpa_is_numeral_positive(Z3_context c, Z3_ast t)
Checks whether a given floating-point numeral is positive.

◆ isSubnormal()

isSubnormal ( self)

Definition at line 10026 of file z3py.py.

10026 def isSubnormal(self):
10027 return Z3_fpa_is_numeral_subnormal(self.ctx.ref(), self.as_ast())
10028
bool Z3_API Z3_fpa_is_numeral_subnormal(Z3_context c, Z3_ast t)
Checks whether a given floating-point numeral is subnormal.

◆ isZero()

isZero ( self)

Definition at line 10016 of file z3py.py.

10016 def isZero(self):
10017 return Z3_fpa_is_numeral_zero(self.ctx.ref(), self.as_ast())
10018
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.

◆ sign()

sign ( self)

Definition at line 9927 of file z3py.py.

9927 def sign(self):
9928 num = (ctypes.c_int)()
9929 nsign = Z3_fpa_get_numeral_sign(self.ctx.ref(), self.as_ast(), byref(num))
9930 if nsign is False:
9931 raise Z3Exception("error retrieving the sign of a numeral.")
9932 return num.value != 0
9933
bool Z3_API Z3_fpa_get_numeral_sign(Z3_context c, Z3_ast t, int *sgn)
Retrieves the sign of a floating-point literal.

◆ sign_as_bv()

sign_as_bv ( self)

Definition at line 9939 of file z3py.py.

9939 def sign_as_bv(self):
9940 return BitVecNumRef(Z3_fpa_get_numeral_sign_bv(self.ctx.ref(), self.as_ast()), self.ctx)
9941
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.

◆ significand()

significand ( self)

Definition at line 9949 of file z3py.py.

9949 def significand(self):
9950 return Z3_fpa_get_numeral_significand_string(self.ctx.ref(), self.as_ast())
9951
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.

◆ significand_as_bv()

significand_as_bv ( self)

Definition at line 9970 of file z3py.py.

9970 def significand_as_bv(self):
9971 return BitVecNumRef(Z3_fpa_get_numeral_significand_bv(self.ctx.ref(), self.as_ast()), self.ctx)
9972
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.

◆ significand_as_long()

significand_as_long ( self)

Definition at line 9959 of file z3py.py.

9959 def significand_as_long(self):
9960 ptr = (ctypes.c_ulonglong * 1)()
9961 if not Z3_fpa_get_numeral_significand_uint64(self.ctx.ref(), self.as_ast(), ptr):
9962 raise Z3Exception("error retrieving the significand of a numeral.")
9963 return ptr[0]
9964
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.