Returns the largest representable number smaller than itself.
(self, context=None)
| 3473 | return ans._fix(context) |
| 3474 | |
| 3475 | def next_minus(self, context=None): |
| 3476 | """Returns the largest representable number smaller than itself.""" |
| 3477 | if context is None: |
| 3478 | context = getcontext() |
| 3479 | |
| 3480 | ans = self._check_nans(context=context) |
| 3481 | if ans: |
| 3482 | return ans |
| 3483 | |
| 3484 | if self._isinfinity() == -1: |
| 3485 | return _NegativeInfinity |
| 3486 | if self._isinfinity() == 1: |
| 3487 | return _dec_from_triple(0, '9'*context.prec, context.Etop()) |
| 3488 | |
| 3489 | context = context.copy() |
| 3490 | context._set_rounding(ROUND_FLOOR) |
| 3491 | context._ignore_all_flags() |
| 3492 | new_self = self._fix(context) |
| 3493 | if new_self != self: |
| 3494 | return new_self |
| 3495 | return self.__sub__(_dec_from_triple(0, '1', context.Etiny()-1), |
| 3496 | context) |
| 3497 | |
| 3498 | def next_plus(self, context=None): |
| 3499 | """Returns the smallest representable number larger than itself.""" |