Returns the smallest representable number larger than itself.
(self, context=None)
| 3496 | context) |
| 3497 | |
| 3498 | def next_plus(self, context=None): |
| 3499 | """Returns the smallest representable number larger than itself.""" |
| 3500 | if context is None: |
| 3501 | context = getcontext() |
| 3502 | |
| 3503 | ans = self._check_nans(context=context) |
| 3504 | if ans: |
| 3505 | return ans |
| 3506 | |
| 3507 | if self._isinfinity() == 1: |
| 3508 | return _Infinity |
| 3509 | if self._isinfinity() == -1: |
| 3510 | return _dec_from_triple(1, '9'*context.prec, context.Etop()) |
| 3511 | |
| 3512 | context = context.copy() |
| 3513 | context._set_rounding(ROUND_CEILING) |
| 3514 | context._ignore_all_flags() |
| 3515 | new_self = self._fix(context) |
| 3516 | if new_self != self: |
| 3517 | return new_self |
| 3518 | return self.__add__(_dec_from_triple(0, '1', context.Etiny()-1), |
| 3519 | context) |
| 3520 | |
| 3521 | def next_toward(self, other, context=None): |
| 3522 | """Returns the number closest to self, in the direction towards other. |