123.3 + 0.1 is 123.3999999999 ?

Greg Ewing (using news.cis.dfn.de) g2h5dqi002 at sneakemail.com
Mon Jun 9 03:45:37 CEST 2003


Andrew Dalke wrote:
> then take the diagonal to get a new number, which is 0.071...
> add one to each digit to get 0.182... and hence a construction
> of a number which is not matched to a Z+.
> 
> Only years later did I learn that that's an approximation, in that
> if the diagonal happens to have 888888888.... then the number
> generated is 99999999.... which may construct a number which
> isn't in [0, 1).

I don't think there has to be any particular system to how you
modify the digits, you just have to choose a different digit at
each position from what was there before. So you can easily
make sure the number stays between 0 and 1.

-- 
Greg Ewing, Computer Science Dept,
University of Canterbury,	
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg





More information about the Python-list mailing list