(self, rhs)
Perform integer division.
Perform integer division.
Perform integer division .
def idiv_int(self, rhs):
        """Perform integer division."""
        if rhs.is_zero():
            # division by zero - return single-precision maximum
            if self.is_negative():
                max_val = Single(None, self._values).from_bytes(Single.neg_max)
            else:
                max_val = Single(None, self._values).from_bytes(Single.pos_max)
            raise ZeroDivisionError(max_val)
        dividend = self.to_int()
        divisor = rhs.to_int()
        # BASIC intdiv rounds to zero, Python's floordiv to -inf
        if (dividend >= 0) == (divisor >= 0):
            return self.from_int(dividend // divisor)
        else:
            return self.from_int(-(abs(dividend) // abs(divisor)))
def idiv_int ( self , rhs ) : if rhs . is_zero ( ) : # division by zero - return single-precision maximum if self . is_negative ( ) : max_val = Single ( None , self . _values ) . from_bytes ( Single . neg_max ) else : max_val = Single ( None , self . _values ) . from_bytes ( Single . pos_max ) raise ZeroDivisionError ( max_val ) dividend = self . to_int ( ) divisor = rhs . to_int ( ) # BASIC intdiv rounds to zero, Python's floordiv to -inf if ( dividend >= 0 ) == ( divisor >= 0 ) : return self . from_int ( dividend // divisor ) else : return self . from_int ( - ( abs ( dividend ) // abs ( divisor ) ) )