(self)
return mantissa * pow(self.BASE, -self.exponent)
return decode plaintext.
return decode plaintext.
return decode plaintext .
def decode(self):
        """return decode plaintext.
        """
        if self.encoding >= self.n:
            # Should be mod n
            raise ValueError('Attempted to decode corrupted number')
        elif self.encoding <= self.max_int:
            # Positive
            mantissa = self.encoding
        elif self.encoding >= self.n - self.max_int:
            # Negative
            mantissa = self.encoding - self.n
        else:
            raise OverflowError(f'Overflow detected in decode number, encoding: {self.encoding}，'
                                f'{self.exponent}'
                                f' {self.n}')

        return mantissa * pow(self.BASE, -self.exponent)
def decode ( self ) : if self . encoding >= self . n : # Should be mod n raise ValueError ( 'Attempted to decode corrupted number' ) elif self . encoding <= self . max_int : # Positive mantissa = self . encoding elif self . encoding >= self . n - self . max_int : # Negative mantissa = self . encoding - self . n else : raise OverflowError ( f'Overflow detected in decode number, encoding: {self.encoding}，' f'{self.exponent}' f' {self.n}' ) return mantissa * pow ( self . BASE , - self . exponent )