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