From 7b41b73eaf3faddfc68f2580d8b978f1d904020e Mon Sep 17 00:00:00 2001 From: StanFromIreland Date: Fri, 6 Dec 2024 16:03:17 +0000 Subject: [PATCH 1/3] Fix typos --- Lib/_pydecimal.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Lib/_pydecimal.py b/Lib/_pydecimal.py index 5b60570c6c592a..60dd4b64107160 100644 --- a/Lib/_pydecimal.py +++ b/Lib/_pydecimal.py @@ -97,7 +97,7 @@ class DecimalException(ArithmeticError): Used exceptions derive from this. If an exception derives from another exception besides this (such as - Underflow (Inexact, Rounded, Subnormal) that indicates that it is only + Underflow (Inexact, Rounded, Subnormal)) that indicates that it is only called if the others are present. This isn't actually used for anything, though. @@ -145,7 +145,7 @@ class InvalidOperation(DecimalException): x ** (+-)INF An operand is invalid - The result of the operation after these is a quiet positive NaN, + The result of the operation after this is a quiet positive NaN, except when the cause is a signaling NaN, in which case the result is also a quiet NaN, but with the original sign, and an optional diagnostic information. @@ -4093,6 +4093,7 @@ def abs(self, a): def add(self, a, b): """Return the sum of the two operands. + >>> ExtendedContext.add(Decimal('12'), Decimal('7.00')) Decimal('19.00') >>> ExtendedContext.add(Decimal('1E+2'), Decimal('1.01E+4')) @@ -5931,7 +5932,7 @@ def _dpower(xc, xe, yc, ye, p): if pc == 0: # we prefer a result that isn't exactly 1; this makes it # easier to compute a correctly rounded result in __pow__ - if ((len(str(xc)) + xe >= 1) == (yc > 0)): # if x**y > 1: + if (len(str(xc)) + xe >= 1) == (yc > 0): # if x**y > 1: coeff, exp = 10**(p-1)+1, 1-p else: coeff, exp = 10**p-1, -p From bca9e815342cb79d7e23b503bdd1429ed74d91fe Mon Sep 17 00:00:00 2001 From: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> Date: Fri, 6 Dec 2024 16:04:58 +0000 Subject: [PATCH 2/3] Update _pydecimal.py --- Lib/_pydecimal.py | 1 - 1 file changed, 1 deletion(-) diff --git a/Lib/_pydecimal.py b/Lib/_pydecimal.py index 60dd4b64107160..2e54593c2436f0 100644 --- a/Lib/_pydecimal.py +++ b/Lib/_pydecimal.py @@ -4093,7 +4093,6 @@ def abs(self, a): def add(self, a, b): """Return the sum of the two operands. - >>> ExtendedContext.add(Decimal('12'), Decimal('7.00')) Decimal('19.00') >>> ExtendedContext.add(Decimal('1E+2'), Decimal('1.01E+4')) From 921c140db9808ecadd806ddea083f817b229a76d Mon Sep 17 00:00:00 2001 From: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> Date: Fri, 6 Dec 2024 18:04:35 +0000 Subject: [PATCH 3/3] Update _pydecimal.py --- Lib/_pydecimal.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/_pydecimal.py b/Lib/_pydecimal.py index 2e54593c2436f0..ec036199331396 100644 --- a/Lib/_pydecimal.py +++ b/Lib/_pydecimal.py @@ -5931,7 +5931,7 @@ def _dpower(xc, xe, yc, ye, p): if pc == 0: # we prefer a result that isn't exactly 1; this makes it # easier to compute a correctly rounded result in __pow__ - if (len(str(xc)) + xe >= 1) == (yc > 0): # if x**y > 1: + if ((len(str(xc)) + xe >= 1) == (yc > 0)): # if x**y > 1: coeff, exp = 10**(p-1)+1, 1-p else: coeff, exp = 10**p-1, -p