Trouble getting loop to break
rdm at rcblue.com
Tue Nov 20 10:45:02 CET 2007
At 12:45 AM 11/20/2007, Dennis Lee Bieber wrote:
>On Mon, 19 Nov 2007 23:41:02 -0800, Dick Moores <rdm at rcblue.com>
>declaimed the following in comp.lang.python:
> > a way to get it to break where I want it to, i.e., when the sum
> > equals the limit as closely as the precision allows?
> > if sum >= limit:
> Well, since it ISN'T a case of testing for an absolute equivalence
> Perhaps putting a "print sum, limit" before that point would reveal
>what type of values you are encountering.
If you run the program you'll see exactly that, if I understand you
correctly. <http://python.pastebin.com/f2f06fd76> shows the full
output for a precision of 50 and x == 5.
More information about the Python-list