--- a/Integer.st Thu Feb 25 12:52:35 2016 +0100
+++ b/Integer.st Fri Feb 26 11:07:13 2016 +0100
@@ -2808,22 +2808,22 @@
Knuth's algorithm for large positive integers, with receiver being
larger than the arg."
- | a b selfLowBit argLowBit shift t |
+ | a b aLowBit bLowBit shift t |
a := self.
b := anInteger.
- selfLowBit := a lowBit - 1.
- argLowBit := b lowBit - 1.
- shift := selfLowBit min:argLowBit.
- b := b bitShift:(argLowBit negated).
+ aLowBit := a lowBit - 1.
+ bLowBit := b lowBit - 1.
+ shift := aLowBit min:bLowBit.
+ b := b bitShift:(bLowBit negated).
[a = 0] whileFalse:[
- a := a bitShift:(selfLowBit negated).
+ a := a bitShift:(aLowBit negated).
a < b ifTrue:[
t := a. a := b. b := t
].
a := a - b.
- selfLowBit := a lowBit - 1.
+ aLowBit := a lowBit - 1.
].
^ b bitShift:shift
@@ -3006,18 +3006,18 @@
v1 := 1.
[
-"/ The following condition is true:
-"/ (a * u1) + (b * v1) ~= gcd1 ifTrue:[self halt].
+ "/ The following condition is true:
+ "/ (a * u1) + (b * v1) ~= gcd1 ifTrue:[self halt].
t := gcd1 divMod:gcd.
gcd1 := gcd.
gcd := t at:2.
t := t at:1.
tmp := v.
-"/v1 - (v * t) - v1 + (v * t) ~= 0 ifTrue:[self halt].
+ "/ v1 - (v * t) - v1 + (v * t) ~= 0 ifTrue:[self halt].
v := v1 - (v * t).
v1 := tmp.
tmp := u.
-"/u1 - (u * t) - u1 + (u * t) ~= 0 ifTrue:[self halt].
+ "/ u1 - (u * t) - u1 + (u * t) ~= 0 ifTrue:[self halt].
u := u1 - (u * t).
u1 := tmp.
gcd > 0] whileTrue.
@@ -3043,7 +3043,7 @@
!
factorial
- "return fac(self) (i.e. 1*2*3...*self) using an iterative algorithm.
+ "return fac(self) (i.e. 1*2*3...*self).
This chooses a good algorithm, based on the receiver.
Some heuristics here, which has to do with the speed of largeInteger
arrithmetic."
@@ -3139,7 +3139,7 @@
!
factorialEvenOdd
- "an recursive odd-even algorithm, which processes smaller largeInts in the loop."
+ "a recursive odd-even algorithm, which processes smaller largeInts in the loop."
|pO i s2 t stop|
@@ -3154,7 +3154,7 @@
"/ 3 * 4 * 5 * 6 *7 * 8 .... * n
"/ odd numbers:
"/ 3 5 7 9 ... n
- "/ half even:
+ "/ even numbers:
"/ 2 4 6 8 ... n
"/ 1 2 3 4 ... n//2
"/ is (n/2)!! << n-1
@@ -3207,7 +3207,7 @@
!
factorialHalf
- "an algorithm, which processes does it with half the number of multiplications.
+ "an algorithm, which does it with half the number of multiplications.
this is faster than factorialPM to roughly 60000."
|p i d|
@@ -3319,7 +3319,7 @@
"return fac(self) (i.e. 1*2*3...*self) using a recursive algorithm.
This is included to demonstration purposes - if you really need
- factorial numbers, use the iterative #factorial, which is
+ factorial numbers, use the tuned #factorial, which is
faster and does not suffer from stack overflow problems (with big receivers)."
(self >= 2) ifTrue:[