Decapitate the payload of a NaN to fit the context
(self, context)
| 1601 | return complex(float(self)) |
| 1602 | |
| 1603 | def _fix_nan(self, context): |
| 1604 | """Decapitate the payload of a NaN to fit the context""" |
| 1605 | payload = self._int |
| 1606 | |
| 1607 | # maximum length of payload is precision if clamp=0, |
| 1608 | # precision-1 if clamp=1. |
| 1609 | max_payload_len = context.prec - context.clamp |
| 1610 | if len(payload) > max_payload_len: |
| 1611 | payload = payload[len(payload)-max_payload_len:].lstrip('0') |
| 1612 | return _dec_from_triple(self._sign, payload, self._exp, True) |
| 1613 | return Decimal(self) |
| 1614 | |
| 1615 | def _fix(self, context): |
| 1616 | """Round if it is necessary to keep self within prec precision. |
no test coverage detected