Converts self to an int, truncating if necessary.
(self)
| 1628 | return float(s) |
| 1629 | |
| 1630 | def __int__(self): |
| 1631 | """Converts self to an int, truncating if necessary.""" |
| 1632 | if self._is_special: |
| 1633 | if self._isnan(): |
| 1634 | raise ValueError("Cannot convert NaN to integer") |
| 1635 | elif self._isinfinity(): |
| 1636 | raise OverflowError("Cannot convert infinity to integer") |
| 1637 | s = (-1)**self._sign |
| 1638 | if self._exp >= 0: |
| 1639 | return s*int(self._int)*10**self._exp |
| 1640 | else: |
| 1641 | return s*int(self._int[:self._exp] or '0') |
| 1642 | |
| 1643 | __trunc__ = __int__ |
| 1644 |
nothing calls this directly
no test coverage detected