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