Returns the smallest representable number larger than itself.
(self, context=None)
| 3529 | context) |
| 3530 | |
| 3531 | def next_plus(self, context=None): |
| 3532 | """Returns the smallest representable number larger than itself.""" |
| 3533 | if context is None: |
| 3534 | context = getcontext() |
| 3535 | |
| 3536 | ans = self._check_nans(context=context) |
| 3537 | if ans: |
| 3538 | return ans |
| 3539 | |
| 3540 | if self._isinfinity() == 1: |
| 3541 | return _Infinity |
| 3542 | if self._isinfinity() == -1: |
| 3543 | return _dec_from_triple(1, '9'*context.prec, context.Etop()) |
| 3544 | |
| 3545 | context = context.copy() |
| 3546 | context._set_rounding(ROUND_CEILING) |
| 3547 | context._ignore_all_flags() |
| 3548 | new_self = self._fix(context) |
| 3549 | if new_self != self: |
| 3550 | return new_self |
| 3551 | return self.__add__(_dec_from_triple(0, '1', context.Etiny()-1), |
| 3552 | context) |
| 3553 | |
| 3554 | def next_toward(self, other, context=None): |
| 3555 | """Returns the number closest to self, in the direction towards other. |
no test coverage detected