Count Down to Zero
rickr at brickroad.net
rickr at brickroad.net
Fri Sep 22 16:53:42 EDT 2000
In article <39CBC0C2.A38342BE at bioeng.ucsd.edu>,
Curtis Jensen <cjensen at bioeng.ucsd.edu> wrote:
> How come Python can't count down to zero? Was it written by ancient
> Romans or something?
>
> Python 1.5.2 (#7, Apr 21 2000, 13:18:02) [C] on irix646
> Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
> >>> float(0)
> 0.0
> >>> float( '0' )
> 0.0
> >>> i = 1.0
> >>> while i >= 0.0:
> ... print i
> ... i = i - 0.1
> ...
> 1.0
> 0.9
> 0.8
> 0.7
> 0.6
> 0.5
> 0.4
> 0.3
> 0.2
> 0.1
> 1.38777878078e-16
> >>>
>
> The last one should be 0.0
>
well I'll be darned... I got the same results on my Pentium II,
running win2k
Sent via Deja.com http://www.deja.com/
Before you buy.
More information about the Python-list
mailing list