Mark Dickinson <dicki...@gmail.com> added the comment:

Okay, here's what I'm planning to commit (tomorrow), in case anyone wants to 
give it one last check.  I've added some comments half-explaining the algorithm 
used (just in case the referenced URL goes out of existence).  I made a couple 
of other minor changes to the algorithm:

(1) in factorial_partial_product, use 'k = (n + num_operands) | 1;' rather than 
'k = (n + num_operands - 1) | 1;'.  This saves an operation, and means that 
when a range including an odd number of terms is split then the bottom half 
gets the extra term, which makes the partial products a teensy bit more 
balanced, since the bottom half consists of smaller numbers.

(2) in factorial_loop, I set the initial value of 'upper' to 3 rather than 1.  
This avoids factorial_partial_product ever being called with a start of 1.

Apart from that, no significant changes.

----------
assignee: stutzbach -> mark.dickinson
Added file: http://bugs.python.org/file17348/factorial2.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue8692>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to