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

Method min

Lib/_pydecimal.py:4860–4885  ·  view source on GitHub ↗

min compares two values numerically and returns the minimum. If either operand is a NaN then the general rules apply. Otherwise, the operands are compared as though by the compare operation. If they are numerically equal then the left-hand operand is chosen as the r

(self, a, b)

Source from the content-addressed store, hash-verified

4858 return a.max_mag(b, context=self)
4859
4860 def min(self, a, b):
4861 """min compares two values numerically and returns the minimum.
4862
4863 If either operand is a NaN then the general rules apply.
4864 Otherwise, the operands are compared as though by the compare
4865 operation. If they are numerically equal then the left-hand operand
4866 is chosen as the result. Otherwise the minimum (closer to negative
4867 infinity) of the two operands is chosen as the result.
4868
4869 >>> ExtendedContext.min(Decimal('3'), Decimal('2'))
4870 Decimal('2')
4871 >>> ExtendedContext.min(Decimal('-10'), Decimal('3'))
4872 Decimal('-10')
4873 >>> ExtendedContext.min(Decimal('1.0'), Decimal('1'))
4874 Decimal('1.0')
4875 >>> ExtendedContext.min(Decimal('7'), Decimal('NaN'))
4876 Decimal('7')
4877 >>> ExtendedContext.min(1, 2)
4878 Decimal('1')
4879 >>> ExtendedContext.min(Decimal(1), 2)
4880 Decimal('1')
4881 >>> ExtendedContext.min(1, Decimal(29))
4882 Decimal('1')
4883 """
4884 a = _convert_other(a, raiseit=True)
4885 return a.min(b, context=self)
4886
4887 def min_mag(self, a, b):
4888 """Compares the values numerically with their sign ignored.

Callers 1

test_minMethod · 0.95

Calls 2

_convert_otherFunction · 0.85
minMethod · 0.45

Tested by 1

test_minMethod · 0.76