Converts self to an int, truncating if necessary.
(self)
| 1572 | return float(s) |
| 1573 | |
| 1574 | def __int__(self): |
| 1575 | """Converts self to an int, truncating if necessary.""" |
| 1576 | if self._is_special: |
| 1577 | if self._isnan(): |
| 1578 | raise ValueError("Cannot convert NaN to integer") |
| 1579 | elif self._isinfinity(): |
| 1580 | raise OverflowError("Cannot convert infinity to integer") |
| 1581 | s = (-1)**self._sign |
| 1582 | if self._exp >= 0: |
| 1583 | return s*int(self._int)*10**self._exp |
| 1584 | else: |
| 1585 | return s*int(self._int[:self._exp] or '0') |
| 1586 | |
| 1587 | __trunc__ = __int__ |
| 1588 |
nothing calls this directly
no test coverage detected