<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman,new york,times,serif;font-size:12pt"><div><span class="corners-top"><span></span></span><a href="http://python-forum.org/pythonforum/viewtopic.php?f=1&amp;t=6155&amp;sid=e6ea194796c708102245da066d61994b#p27746">Why don't range and xrange threat floats as floats?</a><br>Is there any good reason range and xrange don't threat floats as floats but as integers?<br>When I enter float arguments in a range, the floats are treated as integers. (+ some warning)<br><br>This is how I think it should work:<br>&gt;&gt;&gt;range(0, 1, 0.1)<br>[0.0, 0.10000000000000001, 0.20000000000000001, 0.29999999999999999, 0.40000000000000002, 0.5, 0.59999999999999998, 0.69999999999999996, 0.80000000000000004, 0.90000000000000002]<br><br>I got these results by:<br>&gt;&gt;&gt;[x/10. for x in xrange(10)]<br><br>I'm not looking for alternatives, just for the
 reason that it works this way.<br></div></div><br>

      </body></html>