MCPcopy Index your code
hub / github.com/RustPython/RustPython / next_minus

Method next_minus

Lib/_pydecimal.py:3472–3493  ·  view source on GitHub ↗

Returns the largest representable number smaller than itself.

(self, context=None)

Source from the content-addressed store, hash-verified

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

Callers 6

next_towardMethod · 0.95
test_none_argsMethod · 0.95
_decimal_sqrt_of_fracFunction · 0.45
next_minusMethod · 0.45
test_named_parametersMethod · 0.45
test_implicit_contextMethod · 0.45

Calls 11

_check_nansMethod · 0.95
_isinfinityMethod · 0.95
_fixMethod · 0.95
__sub__Method · 0.95
getcontextFunction · 0.85
_dec_from_tripleFunction · 0.85
EtopMethod · 0.80
_set_roundingMethod · 0.80
_ignore_all_flagsMethod · 0.80
EtinyMethod · 0.80
copyMethod · 0.45

Tested by 3

test_none_argsMethod · 0.76
test_named_parametersMethod · 0.36
test_implicit_contextMethod · 0.36