for with decimal values?

Esmail ebonak at hotmail.com
Sun May 3 21:41:23 EDT 2009


Gabriel Genellina wrote:
> 
> Isn't so easy. You have representation errors and rounding errors here, 
> and they accumulate. The last number printed should be 10.4 but I get 10.5:
> ...
> 10.3
> 10.4
> 10.5
> (or more precisely, 10.499999999999959)
> 
> Also, after exiting a for loop, the *last* value used is retained. In 
> your while loop, the ctr variable contains the *next* value.


All this discussion makes me wonder if it would be a good idea
for Python to have this feature (batteries included and all) - it
would have its uses, no?




More information about the Python-list mailing list