Really basic problem

Andreas Tawn andreas.tawn at
Mon Oct 8 15:21:14 CEST 2007

> > I guess this means that Python has some concept of "close 
> enough", but
> > I'll have to defer to someone more knowledgeable to explain that.
> No, not really, except in the sense that any floating point 
> calculation 
> will be necessarily imprecise in that sense.
> So typing 0.3 is the same as typing 0.29999999999999999 or 
> 0.30000000000000001 as far as floating point binary values 
> are concerned.
> (Although note that these results are platform dependent. 
> Your mileage 
> may vary.)
> -- 
> Steven
> -- 

After some caffeine and a head-smack, I realise that you're absolutely
right and I just made the same mistake as the OP (doh).

It does demonstrate just how sneaky floating point representations are


Andreas Tawn
Lead Technical Artist
Ubisoft Reflections

More information about the Python-list mailing list