MCPcopy Create free account
hub / github.com/BasisResearch/lean.py / as_signed_long

Method as_signed_long

lean_py/z3/core.py:762–770  ·  view source on GitHub ↗

Return the signed integer value.

(self)

Source from the content-addressed store, hash-verified

760 raise TypeError("Not a bitvector literal")
761
762 def as_signed_long(self) -> int:
763 """Return the signed integer value."""
764 if isinstance(self._ast, BvLit):
765 val = self._ast.val
766 w = self._ast.width
767 if val >= (1 << (w - 1)):
768 return val - (1 << w)
769 return val
770 raise TypeError("Not a bitvector literal")
771
772 def as_string(self) -> str:
773 return str(self.as_long())

Calls

no outgoing calls

Tested by 3