Re: [Tutor] while loop ends prematurly

2012-01-02 Thread Walter Prins
Hi Steven, On 2 January 2012 06:28, Steven D'Aprano st...@pearwood.info wrote: That only applies to decimal values which can be represented using a fixed number of decimal places. So 1/5 is fine, and is 0.2 exactly, but 1/3 is not, since it would require an infinite number of decimal places.

Re: [Tutor] while loop ends prematurly

2012-01-02 Thread Dave Angel
(You accidentally forgot to include the list when you replied. The easiest way (for most people) to avoid that is to use Reply-all) On 01/02/2012 01:00 AM, Sarma Tangirala wrote: On 2 Jan 2012 08:56, Dave Angeld...@davea.name wrote: Easiest answer is to use integers. Scale everything up

Re: [Tutor] while loop ends prematurly

2012-01-02 Thread Walter Prins
Hi again, On 2 January 2012 06:28, Steven D'Aprano st...@pearwood.info wrote: Another answer is to use Decimal class, which CAN represent decimal values exactly. That only applies to decimal values which can be represented using a fixed number of decimal places. So 1/5 is fine, and is 0.2

[Tutor] while loop ends prematurly

2012-01-01 Thread brian arb
Hello, Can some please explain this to me? My while loop should continue while owed is greater than or equal to d first time the function is called the loop exits as expected False: 0.00 = 0.01 the next time it does not False: 0.01 = 0.01 Below is the snippet of code, and the out

Re: [Tutor] while loop ends prematurly

2012-01-01 Thread Dave Angel
On 01/01/2012 09:48 PM, brian arb wrote: Hello, Can some please explain this to me? My while loop should continue while owed is greater than or equal to d first time the function is called the loop exits as expected False: 0.00= 0.01 the next time it does not False: 0.01= 0.01

Re: [Tutor] while loop ends prematurly

2012-01-01 Thread Hugo Arts
On Mon, Jan 2, 2012 at 3:48 AM, brian arb brianjames...@gmail.com wrote: Hello, Can some please explain this to me? My while loop should continue while owed is greater than or equal to d first time the function is called the loop exits as expected False: 0.00 = 0.01 the next time

Re: [Tutor] while loop ends prematurly

2012-01-01 Thread Steven D'Aprano
Dave Angel wrote: Easiest answer is to use integers. Scale everything up by a factor of 100, and you won't need floats at all. Just convert when printing (and even then you may get into trouble). Another answer is to use Decimal class, which CAN represent decimal values exactly. That