(self, rhs)
return self.from_int(mod)
Left modulo right.
Left modulo right.
Left modulo right .
def imod(self, rhs):
        """Left modulo right."""
        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 MOD has same sign as dividend, Python mod has same sign as divisor
        mod = dividend % divisor
        if dividend < 0 or mod < 0:
            mod -= divisor
        return self.from_int(mod)
def imod ( 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 MOD has same sign as dividend, Python mod has same sign as divisor mod = dividend % divisor if dividend < 0 or mod < 0 : mod -= divisor return self . from_int ( mod )