Trouble getting loop to break

Dick Moores rdm at
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>
>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
>with floats...
>         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. <> shows the full 
output for a precision of 50 and x == 5.


More information about the Python-list mailing list