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