(self, context)
return Decimal(self)
Decapitate the payload of a NaN to fit the context
Decapitate the payload of a NaN to fit the context
Decapitate the payload of a NaN to fit the context
def _fix_nan(self, context):
        """Decapitate the payload of a NaN to fit the context"""
        payload = self._int

        # maximum length of payload is precision if clamp=0,
        # precision-1 if clamp=1.
        max_payload_len = context.prec - context.clamp
        if len(payload) > max_payload_len:
            payload = payload[len(payload)-max_payload_len:].lstrip('0')
            return _dec_from_triple(self._sign, payload, self._exp, True)
        return Decimal(self)
def _fix_nan ( self , context ) : payload = self . _int # maximum length of payload is precision if clamp=0, # precision-1 if clamp=1. max_payload_len = context . prec - context . clamp if len ( payload ) > max_payload_len : payload = payload [ len ( payload ) - max_payload_len : ] . lstrip ( '0' ) return _dec_from_triple ( self . _sign , payload , self . _exp , True ) return Decimal ( self )