summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2002-08-14 17:07:32 (GMT)
committerTim Peters <tim.peters@gmail.com>2002-08-14 17:07:32 (GMT)
commit48d52c0fccb23c213402476992c42664f07cdca1 (patch)
tree97577c3e58b3ce123c580af5d3622bd08c9ddf1a /Objects
parentb8c20a723f7f0dd4c78ae4daa7934c43749f04c1 (diff)
downloadcpython-48d52c0fccb23c213402476992c42664f07cdca1.zip
cpython-48d52c0fccb23c213402476992c42664f07cdca1.tar.gz
cpython-48d52c0fccb23c213402476992c42664f07cdca1.tar.bz2
k_mul() comments: Simplified the simplified explanation of why ah*bh and
al*bl "always fit": it's actually trivial given what came before.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/longobject.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/Objects/longobject.c b/Objects/longobject.c
index 1c4a343..348dcc4 100644
--- a/Objects/longobject.c
+++ b/Objects/longobject.c
@@ -1792,12 +1792,9 @@ Else (bsize is odd and asize < bsize) ah and al each have at most shift digits,
so ah+al has at most shift digits + 1 bit, and (ah+al)*(bh+bl) has at most
2*shift+1 digits + 2 bits, and again 2*shift+2 digits is enough to hold it.
-Note that the "lazy" analysis is enough to show that there's always enough
-room to subtract al*bl and ah*bh. al and bl each have no more than shift
-digits, so al*bl has no more than 2*shift, so there's at least one digit
-to spare in the remaining allocated digits. The same is true for ah*bh when
-bsize is even. When bsize is odd, ah*bh has at most 2*shift+2 digits, and
-there are at least that many remaining allocated digits when bsize is odd.
+Note that since there's always enough room for (ah+al)*(bh+bl), and that's
+clearly >= each of ah*bh and al*bl, there's always enough room to subtract
+ah*bh and al*bl too.
*/
/* b has at least twice the digits of a, and a is big enough that Karatsuba