MCPcopy Index your code
hub / github.com/python/cpython / next_minus

Method next_minus

Lib/_pydecimal.py:4956–4974  ·  view source on GitHub ↗

Returns the largest representable number smaller than a. >>> c = ExtendedContext.copy() >>> c.Emin = -999 >>> c.Emax = 999 >>> ExtendedContext.next_minus(Decimal('1')) Decimal('0.999999999') >>> c.next_minus(Decimal('1E-1007')) Decimal('0E-100

(self, a)

Source from the content-addressed store, hash-verified

4954 return r
4955
4956 def next_minus(self, a):
4957 """Returns the largest representable number smaller than a.
4958
4959 >>> c = ExtendedContext.copy()
4960 >>> c.Emin = -999
4961 >>> c.Emax = 999
4962 >>> ExtendedContext.next_minus(Decimal('1'))
4963 Decimal('0.999999999')
4964 >>> c.next_minus(Decimal('1E-1007'))
4965 Decimal('0E-1007')
4966 >>> ExtendedContext.next_minus(Decimal('-1.00000003'))
4967 Decimal('-1.00000004')
4968 >>> c.next_minus(Decimal('Infinity'))
4969 Decimal('9.99999999E+999')
4970 >>> c.next_minus(1)
4971 Decimal('0.999999999')
4972 """
4973 a = _convert_other(a, raiseit=True)
4974 return a.next_minus(context=self)
4975
4976 def next_plus(self, a):
4977 """Returns the smallest representable number larger than a.

Callers 1

test_next_minusMethod · 0.95

Calls 2

_convert_otherFunction · 0.85
next_minusMethod · 0.45

Tested by 1

test_next_minusMethod · 0.76