'Converts self to an int, truncating if necessary.'

def __int__(self):

    if self._is_special:
        if self._isnan():
            raise ValueError('Cannot    convert    NaN    to    integer')
        elif self._isinfinity():
            raise OverflowError('Cannot    convert    infinity    to    integer')
    s = ((-1) ** self._sign)
    if (self._exp >= 0):
        return ((s * int(self._int)) * (10 ** self._exp))
    else:
        return (s * int((self._int[:self._exp] or '0')))
