Trouble getting loop to break

Dick Moores rdm at rcblue.com
Tue Nov 20 16:00:04 EST 2007


At 10:42 AM 11/20/2007, davisn90210 at gmail.com wrote:
>Instead of comparing sum to the "known" value of e**x, why not test
>for convergence?  I.e., if sum == last_sum: break.  Seems like that
>would be more robust (you don't need to know the answer to computer
>the answer), since it seems like it should converge.

Yes! And believe it or not I did that before seeing your post. Works 
well. See <http://python.pastebin.com/f7c37186a>

And also with the amazing Chudnovsky algorithm for pi. See 
<http://python.pastebin.com/f4410f3dc>

Thanks,

Dick





More information about the Python-list mailing list